Advertisement
Guest User

Untitled

a guest
Feb 24th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. #include <vector>
  2. #include <algorithm>
  3. #include <fstream>
  4. #include<string>
  5. #include <iostream>
  6. using namespace std;
  7. #include <map>;
  8. # include <set>;
  9.  
  10.  
  11.  
  12.  
  13. int main() {
  14.     vector<string> x(1000);
  15.     string s,ss;
  16.     getline(cin, s);
  17.     int n;
  18.     cin >> n;
  19.     int flag=0;
  20.     getline(cin, x[0]);
  21.     for (int i = 0; i < n; i++) {
  22.         getline(cin, ss);
  23.         int flag1 = 0;
  24.         if (s.size() == ss.size()) {
  25.             flag1 = 1; // совпадают ли два логина  1-да 0-нет
  26.             for (int j = 0; j < s.size(); j++) {
  27.                 int flag2 = 0;//совпадают ли 2 буквы 0-нет 1-да
  28.                 if (s[j] == ss[j] ) flag2 = 1;
  29.                 if (s[j] - ss[j] == 'A' - 'a' && s[j]>='A' && s[j]<='Z') flag2 = 1;
  30.                 if (ss[j] - s[j] == 'A' - 'a' && ss[j] >= 'A' && ss[j] <= 'Z') flag2 = 1;
  31.  
  32.                 if (s[j] == 'O' && ss[j] == '0') flag2 = 1;
  33.                 if (s[j] == '0'&& ss[j] == 'O') flag2 = 1;
  34.                 if (s[j] == 'o' && ss[j] == '0') flag2 = 1;
  35.                 if (s[j] == '0'&& ss[j] == 'o') flag2 = 1;
  36.  
  37.                 if (s[j] == '1'&& ss[j] == 'l') flag2 = 1;
  38.                 if (s[j] == '1'&& ss[j] == 'I') flag2 = 1;
  39.                 if (s[j] == 'I'&& ss[j] == '1') flag2 = 1;
  40.                 if (s[j] == 'I'&& ss[j] == 'l') flag2 = 1;
  41.                 if (s[j] == 'l'&& ss[j] == '1') flag2 = 1;
  42.                 if (s[j] == 'l'&& ss[j] == 'I') flag2 = 1;
  43.  
  44.                 if (s[j] == '1'&& ss[j] == 'L') flag2 = 1;
  45.                 if (s[j] == '1'&& ss[j] == 'i') flag2 = 1;
  46.                 if (s[j] == 'i'&& ss[j] == '1') flag2 = 1;
  47.                 if (s[j] == 'i'&& ss[j] == 'L') flag2 = 1;
  48.                 if (s[j] == 'L'&& ss[j] == '1') flag2 = 1;
  49.                 if (s[j] == 'L'&& ss[j] == 'i') flag2 = 1;
  50.                 if (flag2 == 0) {     // если две буквы не совпадают flag1=0 то два слова не совпадают
  51.                     //cout << i << ' ' << j << endl;
  52.                     flag1 = 0;
  53.                 }
  54.                 //cout << flag1<<' '<<i<<' '<<j<<endl;
  55.                    
  56.             }
  57.         }
  58.  
  59.         if (flag1 == 1) {
  60.             flag = 1;// cout << i;
  61.         }
  62.  
  63.     }
  64.     if (flag == 1) cout << "NO";
  65.     else
  66.         cout << "YES";
  67.  
  68.     cin >> n;
  69.    
  70.     return(0);
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement