D_L3

SDA - 2022-2023 - test5 - task 1

Dec 11th, 2023
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <cmath>
  2. #include <cstdio>
  3. #include <vector>
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <unordered_map>
  7.  
  8. using namespace std;
  9.  
  10.  
  11. int main() {
  12.     unordered_map<string, int> words;
  13.     string word;
  14.     while(cin >> word) {
  15.         words[word]++;
  16.     }
  17.    
  18.     vector<string> result;
  19.     for(auto i : words){
  20.         if(i.second == 1){
  21.             result.push_back(i.first);
  22.         }
  23.     }
  24.     sort(result.begin(), result.end());
  25.     for(string currWord : result){
  26.         cout << currWord << endl;
  27.     }
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment