原题
题解
白给题
代码
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
int main(void) {
int n;
map<string,string> m;
vector<string> v;
cin >> n;
for (int i = 0;i < n;i++) {
string userName;
string password;
cin >> userName >> password;
bool isModified = false;
for (int j = 0;j < password.length();j++) {
if (password[j] == '1') {
password[j] = '@';
isModified = true;
} else if (password[j] == '0') {
password[j] = '%';
isModified = true;
} else if (password[j] == 'l') {
password[j] = 'L';
isModified = true;
} else if (password[j] == 'O') {
password[j] = 'o';
isModified = true;
}
}
if (isModified) {
v.push_back(userName);
m[userName] = password;
}
}
int size = v.size();
if (size) {
cout << size << endl;
for (auto it : v) {
cout << it << " " << m[it] << endl;
}
} else {
if (n > 1) {
cout << "There are " << n << " accounts and no account is modified" << endl;
} else {
cout << "There is " << n << " account and no account is modified" << endl;
}
}
return 0;
}
发表评论