srtgguy

Untitled

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