没难度上代码。
#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
int main() {
int n;
string name, pw;
scanf ("%d", &n);
for (int i = 0; i < n; i++) {
int flag = 0;
cin >> name >> pw;
for (int j = 0; j < pw.size(); j++) {
switch (pw[j]) {
case '1': pw[j] = '@'; flag = 1; break;
case '0': pw[j] = '%'; flag = 1; break;
case 'l': pw[j] = 'L'; flag = 1; break;
case 'O': pw[j] = 'o'; flag = 1; break;
}
}
if (flag == 1) ans.push_back (name + " " + pw);
}
if (ans.size() == 0) {
if (n == 1) printf ("There is 1 account and no account is modified");
else printf ("There are %d accounts and no account is modified", n);
return 0;
}
printf ("%d\n", ans.size());
for (int i = 0; i < ans.size(); i++)
printf ("%s\n", ans[i].c_str());
}
|