Advertisement
Derga

Untitled

Jul 30th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. #include <string>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     int n;
  10.     cin >> n;
  11.     vector <string> v;
  12.     set<string> s;
  13.  
  14.     for (int i = 0; i < n; ++i) {
  15.         string str;
  16.         getline(cin, str);
  17.         if (!s.count(str)) {
  18.             v.push_back(str);
  19.             s.insert(str);
  20.         }
  21.     }
  22.  
  23.     for (const auto& elem : v) {
  24.         cout << elem << endl;
  25.     }
  26.  
  27.     return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement