-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy path1035_Password (20).cpp
56 lines (54 loc) · 1.42 KB
/
1035_Password (20).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
54
55
56
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct info
{
string name;
string pwd;
int ok;
info(){ ok = 0;};
}tmp;
int main()
{
vector<info> e;
int n,i,j;
while(cin >> n)
{
e.clear();
int flag = 0;
int cnt = 0;
for(i = 0; i < n; i++)
{
cin >> tmp.name >> tmp.pwd;
int ok = 0;
for(j = 0; j < tmp.pwd.size(); j++)
{
if(tmp.pwd[j] == '1') {tmp.pwd[j] = '@'; ok = 1; flag = 1;}
if(tmp.pwd[j] == '0') {tmp.pwd[j] = '%'; ok = 1; flag = 1;}
if(tmp.pwd[j] == 'l') {tmp.pwd[j] = 'L'; ok = 1; flag = 1;}
if(tmp.pwd[j] == 'O') {tmp.pwd[j] = 'o'; ok = 1; flag = 1;}
}
tmp.ok = ok;
if(tmp.ok) cnt++;
e.push_back(tmp);
}
if(!flag)
{
if(e.size() == 1) cout << "There is " << e.size() << " account and no account is modified" << endl;
if(e.size() > 1) cout << "There are " << e.size() << " accounts and no account is modified" << endl;
}
else
{
cout << cnt << endl;
for(i = 0; i < e.size(); i++)
{
if(e[i].ok)
{
cout << e[i].name << " " << e[i].pwd << endl;
}
}
}
}
return 0;
}