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!
text 2.64 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <cstdio>
  3. #include <vector>
  4. #include <string>
  5. #include <iostream>
  6. #include <algorithm>
  7. #include <map>
  8. #include <iterator>
  9. #include <functional>
  10. #include <set>
  11. #include <stack>
  12. #include <queue>
  13. #include <deque>
  14. #include <fstream>
  15. #include <iomanip>
  16. #include <numeric>
  17. #include <cmath>
  18. #include <list>
  19. #include <sstream>
  20. #include <cstring>
  21. #include <stdio.h>
  22. using namespace std;
  23. #pragma GCC optimize("O3")
  24. #pragma GCC target("sse4")
  25.  
  26. typedef long double LD;
  27. typedef long long LL;
  28. typedef unsigned long long ULL;
  29. typedef pair<int, int> PII;
  30. typedef pair<LD, LD> PDD;
  31. typedef pair<LL, int> PLL;
  32. typedef vector<int> VI;
  33. typedef vector<LL> VLL;
  34. typedef vector<char> VCH;
  35. typedef vector<LD> VLD;
  36. typedef vector<string> VS;
  37. typedef vector<VS> VSS;
  38. typedef vector<VI> VVI;
  39. typedef vector<VLL> VVLL;
  40. typedef vector<VCH> VVCH;
  41. typedef vector<PII> VPII;
  42. typedef vector<PLL> VPLL;
  43. typedef vector<PDD> VPDD;
  44. #define MP make_pair
  45. #define PB push_back
  46. #define X first
  47. #define Y second
  48. #define next fake_next
  49. #define prev fake_prev
  50. #define left fake_left
  51. #define right fake_right
  52.  
  53. #define FOR(i,a,b) for(int i = (a); i < (b); ++i)
  54. #define RFOR(i,b,a) for(int i = (b) - 1; i >= (a); --i)
  55. #define REP(i, t) FOR(i,0,t)
  56. #define ALL(a) a.begin(), a.end()
  57. #define SZ(a) (int)((a).size())
  58. #define FILL(a, value) memset(a, value, sizeof(a))
  59.  
  60. const LD PI = acos(-1.0);
  61. const LD EPS = 1e-4;
  62. const LL INF = 1e7 - 1;
  63. const LL mod = 1000000007;
  64. const LL LINF = 1e18 + 10;
  65. const int MAXN = 10001;
  66. const int MAXK = 101;
  67.  
  68. bool real_check(char x, char y)
  69. {
  70. if (x == '0' && y == 'O')
  71. return 1;
  72.  
  73. if (x == 'O' && y == '0')
  74. return 1;
  75.  
  76. if (x == '1' || x == 'l' || x == 'I')
  77. {
  78. if (y == '1' || y == 'l' || y == 'I')
  79. {
  80. return 1;
  81. }
  82. }
  83.  
  84. if (x >= 'A' && x <= 'Z')
  85. x += 32;
  86. if (y >= 'A' && y <= 'Z')
  87. y += 32;
  88.  
  89. if (x == y)
  90. return 1;
  91.  
  92. return 0;
  93. }
  94.  
  95. bool check(char x, char y)
  96. {
  97. char x1 = x, x2 = x + 32;
  98. if (x >= 'a')
  99. x2 -= 64;
  100.  
  101. char y1 = y, y2 = y + 32;
  102. if (y >= 'a')
  103. y2 -= 64;
  104.  
  105. return real_check(x1, y1) || real_check(x1, y2) || real_check(x2, y1) || real_check(x2, y2);
  106. }
  107.  
  108. bool check(string s, string t)
  109. {
  110. if (SZ(s) != SZ(t))
  111. return 0;
  112.  
  113. FOR(i, 0, SZ(s))
  114. if (s[i] != t[i])
  115. if (!check(s[i], t[i]))
  116. return 0;
  117.  
  118. return 1;
  119. }
  120.  
  121. int main()
  122. {
  123. ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  124. //freopen("In.txt", "r", stdin);
  125.  
  126. string s;
  127. cin >> s;
  128.  
  129. int n;
  130. cin >> n;
  131. string t;
  132. FOR(i, 0, n)
  133. {
  134. cin >> t;
  135. if (check(s, t))
  136. {
  137. cout << "No" << endl;
  138. return 0;
  139. }
  140. }
  141.  
  142. cout << "Yes" << endl;
  143. return 0;
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement