Advertisement
srtgguy

Untitled

May 23rd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <set>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int n;
  10.     cin >> n;
  11.     string trash;
  12.     getline(cin, trash);
  13.     set<string> names;
  14.     string magaz;
  15.     int k = 0;
  16.     for (int i = 0; i < n; i++)
  17.     {
  18.         getline(cin, magaz);
  19.         if (names.find(magaz) != names.end())
  20.         {
  21.             k++;
  22.         }
  23.         else
  24.         {
  25.             names.insert(magaz);
  26.         }
  27.     }
  28.     cout << k << endl;
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement