-
Notifications
You must be signed in to change notification settings - Fork 0
/
1035.cpp
53 lines (45 loc) · 1.11 KB
/
1035.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <string>
using namespace std;
const int MAXN = 1000 + 10;
struct user {
string name, pwd;
bool isBad;
} us[MAXN];
bool check(string &s) {
for (auto &c : s) {
if (c == '1' || c == 'l' || c == '0' || c == 'O') return true;
}
return false;
}
bool shift(string &s) {
for (auto &c : s) {
if (c == '1') c = '@';
if (c == '0') c = '%';
if (c == 'l') c = 'L';
if (c == 'O') c = 'o';
}
}
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> us[i].name >> us[i].pwd;
if (check(us[i].pwd)) {
us[i].isBad = true;
shift(us[i].pwd);
ans++;
}
}
if (ans == 0) {
if (n == 1) cout << "There is " << n << " account and no account is modified" << endl;
else cout << "There are " << n << " accounts and no account is modified" << endl;
} else {
cout << ans << endl;
for (int i = 0; i < n; i++) {
if (us[i].isBad) cout << us[i].name << " " << us[i].pwd << endl;
}
}
return 0;
}