1035. Password

Source: Internet
Author: User

1035. Password (20) time limit MS Memory limit 65536 KB code length limit 16000 B award Program StandardAuthor Chen, Yue

To prepare for PAT, the judge sometimes have to generate random passwords for the users. The problem is this there is always some confusing passwords since it's hard-to-distinguish 1 (one) from L (L in Lowerca SE), or 0 (zero) from O (o in uppercase). One solution is to replace 1 (one) by @, 0 (zero) by%, l by L, and O by O. Now it's your job to write a program to check the accounts generated by the judge, and to help the juge modify the Confus ing passwords.

Input Specification:

Each input file contains the one test case. Each case contains a positive an integer n (<=), followed by N lines of accounts. Each account consists of a user name and a password, both is strings of no more than than characters with no space.

Output Specification:

For each test case, first print the number M of accounts that has been modified, then print in the following M lines the Modified accounts info, that's, the user names and the corresponding modified passwords. The accounts must is printed in the same order as they is read in. If no account was modified, print in one line "there be N accounts and no account is modified" where N was the total number of accounts. However, if N is one, you must print "There are 1 account and no account is modified" instead.

Sample Input 1:

3team000002 rlsp0dfateam000003 perfectpwdTeam000001 R1spodfa
Sample Output 1:
2team000002 rlsp%dfateam000001 [email protected]
Sample Input 2:
1team110 abcdefg332
Sample Output 2:
There is 1 account and no account is modified
Sample Input 3:
2team110 abcdefg222team220 abcdefg333
Sample Output 3:
There is 2 accounts and No. is modified
1#include <stdio.h>2#include <math.h>3#include <stdlib.h>4#include <string.h>5 6 intMain ()7 {8     intN, I, j, Count =0, flag[1010] = {};9     Characu[1010][ the], pwd[1010][ the];Tenscanf"%d", &n); One      for(i =0; I < n; i++) A     { -scanf"%s%s", Acu[i], pwd[i]); -         intLen =strlen (Pwd[i]); the          for(j =0; J < Len; J + +) -         { -             if(Pwd[i][j] = ='1') -             { +Flag[i] =1; -PWD[I][J] ='@'; +             } A             Else if(Pwd[i][j] = ='0') at             { -Flag[i] =1; -PWD[I][J] ='%'; -             } -             Else if(Pwd[i][j] = ='L') -             { inFlag[i] =1; -PWD[I][J] ='L'; to             } +             Else if(Pwd[i][j] = ='O') -             { theFlag[i] =1; *PWD[I][J] ='o'; $             }Panax Notoginseng         } -         if(Flag[i]) thecount++; +     } A     if(Count = =0) the     { +         if(n = =1) -printf"There is%d account and no account is modified\n", n); $         Else $printf"There is%d accounts and No. is modified\n", n); -     } -     Else the     { -printf"%d\n", count);Wuyi          for(i =0; I < n; i++) the         { -             if(Flag[i]) Wu             { -printf"%s%s\n", Acu[i], pwd[i]); About             } $         } -     } -     return 0; -}

1035. Password

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.