解法一:模拟

  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. vector<pair<string, string>> ans;
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(0);
  7. int N, M = 0;
  8. cin >> N;
  9. string name, password;
  10. for (int i = 0; i < N; ++i) {
  11. cin >> name >> password;
  12. bool flag = false;
  13. for (auto &it:password) {
  14. switch (it) {
  15. case '0':
  16. it = '%';
  17. flag = true;
  18. break;
  19. case 'O':
  20. it = 'o';
  21. flag = true;
  22. break;
  23. case '1':
  24. it = '@';
  25. flag = true;
  26. break;
  27. case 'l':
  28. flag = true;
  29. it = 'L';
  30. break;
  31. }
  32. }
  33. if (flag) {
  34. ans.emplace_back(make_pair(name, password));
  35. }
  36. }
  37. if (ans.empty()) {
  38. if (N == 1) {
  39. cout << "There is 1 account and no account is modified\n";
  40. } else {
  41. cout << "There are " << N << " accounts and no account is modified\n";
  42. }
  43. } else {
  44. cout << ans.size() << '\n';
  45. for (auto &it:ans) {
  46. cout << it.first << " " << it.second << '\n';
  47. }
  48. }
  49. }