Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- const char o[3] = {'0','o','O'};
- const char is[5] = {'1','I','l','i','L'};
- bool same(string a, string b) {
- if (a.length() != b.length() ) return false;
- for (int i = 0; i<(int)a.length(); i++) {
- int os=0,iss=0;
- for (int j = 0; j<3; j++) {
- if (a[i] == o[j])os++;
- if (b[i]==o[j]) os++;
- }
- for (int j = 0;j<5;j++) {
- if (a[i] == is[j]) iss++;
- if (b[i] == is[j]) iss++;
- }
- if (!(toupper(a[i])==toupper(b[i]) || iss==2 || os==2))
- return false;
- }
- return true;
- }
- int main() {
- int n;
- string s,t;
- cin >>s>>n;
- for (int i =0; i<n;i++){
- cin >> t;
- if (same(s,t)) {
- cout << "No";
- return 0;
- }
- }
- cout <<"Yes";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement