Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- #include <vector>
- #include <string>
- #include <set>
- using namespace std;
- int main()
- {
- set<string> names;
- string trash, name;
- set<string> arr;
- int n;
- cin >> n;
- getline(cin, trash);
- for (int i = 0; i < n; i++)
- {
- getline (cin, name);
- if (names.find(name) != names.end())
- {
- arr.insert(name);
- }
- names.insert(name);
- }
- for(auto it = arr.begin(); it != arr.end(); it++)
- {
- cout << *it << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment