Advertisement
Spocoman

06. Unique Usernames

Jan 21st, 2024
1,221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <set>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int n;
  9.     cin >> n;
  10.  
  11.     string name;
  12.  
  13.     set<string> names;
  14.  
  15.     for (int i = 0; i < n; i++) {
  16.         cin >> name;
  17.         names.insert(name);
  18.     }
  19.  
  20.     for (auto& n : names) {
  21.         cout << n << endl;
  22.     }
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement