Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- #include <unordered_map>
- #include <string>
- using namespace std;
- int main() {
- unordered_map<string, int> words;
- unordered_map<string, int> resWords;
- int cnt = 0;
- string word;
- while (true)
- {
- if (cin.peek() == '\n')
- {
- cnt ++;
- if (cnt == 2)
- {
- break;
- }
- }
- cin >> word;
- if (words.find(word) == words.end())
- {
- words.insert(make_pair(word, 1));
- resWords.insert(make_pair(word, 1));
- }
- else
- {
- words[word] ++;
- resWords[word] = 0;
- }
- }
- vector<string> results;
- for (auto i : words)
- {
- if (i.second == 1)
- {
- results.push_back(i.first);
- }
- }
- sort(results.begin(), results.end());
- for (int i = 0; i < results.size(); i++)
- {
- cout << results[i] << " ";
- }
- int x;
- cin >> x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement