lalalalalalalaalalla

Untitled

Jun 5th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <iostream>
  3. #include <map>
  4. #include <cstdlib>
  5. #include <cstdio>
  6. #include <fstream>
  7. #include <set>
  8. #include <unordered_set>
  9. #include <unordered_map>
  10. #include <string>
  11. #include <random>
  12. #include <string>
  13. #include <algorithm>
  14. #include <iomanip>
  15. #include <stack>
  16. #include <queue>
  17. #include <deque>
  18. #include <cmath>
  19. #define sz(v) ((int)(v).size())
  20. #define int long long
  21. #define all(a) (a).begin(), (a).end()
  22. #define pii pair<int, int>
  23. using namespace std;
  24. void solve() {
  25. int n;
  26. cin >> n;
  27. map <string, vector<string>> mp;
  28. for(int i =0;i < n;i++){
  29. string s;
  30. cin >> s;
  31. string pattern="";
  32. for(int u = 0;u < (int)s.size();u++){
  33. if(s[u] >= 'A' && s[u] <= 'Z'){
  34. char x = s[u] - 'A' + 'a';
  35. pattern += x;
  36. }
  37. else{
  38. pattern += s[u];
  39. }
  40. }
  41. if(mp.find(pattern) != mp.end()){
  42. mp[pattern].push_back(s);
  43. }
  44. else{
  45. mp[pattern] = vector<string>(1, s);
  46. }
  47. }
  48. string s;
  49. getline(cin, s);
  50. getline(cin, s);
  51. string temp = "";
  52. int cnt = 0;
  53. int all = 0;
  54. for(int i =0;i < s.size() +1;i++){
  55. if(i != s.size() && ((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))) {
  56. temp += s[i];
  57. if(s[i] <= 'Z' && s[i] >= 'A') cnt++;
  58. }
  59. else{
  60. if (temp.empty()) {
  61. cnt = 0;
  62. continue;
  63. }
  64. string check = "";
  65. char a;
  66. for(int u = 0;u < temp.size();u++){
  67. if(temp[u] <= 'Z' && temp[u] >= 'A'){
  68. char x = temp[u] - 'A' + 'a';
  69. check += x;
  70. a = x;
  71. }
  72. else{
  73. check += temp[u];
  74. }
  75. }
  76. if(mp.find(check) != mp.end()){
  77. if(!mp[check].empty() && find(mp[check].begin(), mp[check].end(), temp) == mp[check].end()){
  78. all+=1;
  79. }
  80. }
  81. else{
  82. if(cnt != 1){
  83. all += 1;
  84. }
  85. }
  86.  
  87. temp="";
  88. cnt = 0;
  89. }
  90. }
  91. cout << all << endl;
  92. }
  93. signed main()
  94. {
  95. ios::sync_with_stdio(false);
  96. cin.tie(0);
  97. cout.tie(0);
  98. int m = 1;
  99. //cin >> m;
  100. while (m--)
  101. {
  102. solve();
  103. }
  104. return 0;
  105. }
Advertisement
Add Comment
Please, Sign In to add comment