Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- int main()
- {
- ll n;
- while (cin >> n && n != 0)
- {
- cin.ignore();
- map<string, set<string>> z1;
- while (n-- > 0)
- {
- string x;
- getline(cin, x);
- stringstream ss(x);
- ss >> x;
- string ax;
- while (ss >> ax)
- {
- z1[ax].insert(x);
- }
- }
- for (auto cl : z1)
- {
- cout << cl.first << " ";
- for (auto cs : cl.second)
- {
- cout << cs << " ";
- }
- cout << endl;
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement