输入用例1:
3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa
输出用例1:
2
Team000002 RLsp%dfa
Team000001 R@spodfa
输入用例2
1
team110 abcdefg332
输出用例2
There is 1 account and no account is modified
输入用例3
2
team110 abcdefg222
team220 abcdefg333
输出用例3
There are 2 accounts and no account is modified
代码
#include<bits/stdc++.h>
using namespace std;
struct Acount{
char id[20];
char pwd[20];
bool change = false;
}person[1001];
int main()
{
int n, cnt = 0;
scanf("%d", &n);
bool flag = true;
for(int i = 0; i < n; i++){
scanf("%s %s", person[i].id, person[i].pwd);
}
for(int i = 0; i < n; i++){
int len = strlen(person[i].pwd);
for(int j = 0; j < len; j++){
if(person[i].pwd[j] == '1'){
person[i].pwd[j] = '@';
person[i].change = true;
} else if(person[i].pwd[j] == '0'){
person[i].pwd[j] = '%';
person[i].change = true;
} else if(person[i].pwd[j] == 'l'){
person[i].pwd[j] = 'L';
person[i].change = true;
} else if(person[i].pwd[j] == 'o'){
person[i].pwd[j] = 'O';
person[i].change = true;
}
}
if(person[i].change == true) cnt++;
}
if(cnt == 0){
if(n == 1){
printf("There is %d account and no account is modified", n);
}else{
printf("There are %d accounts and no account is modified", n);
}
}else{
printf("%d\n", cnt);
for(int i = 0; i < n; i++) {
if(person[i].change == true) {
printf("%s %s\n", person[i].id, person[i].pwd);
}
}
}
}