Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- using namespace std;
- typedef map<string,string>::iterator ite;
- int main() {
- string s;
- map<string,string> liats;
- while(cin >> s) {
- if (s == "affair") {
- string x, y;
- cin >> x >> y;
- if (liats[x] != "") liats[liats[x]] = "";
- if (liats[y] != "") liats[liats[y]] = "";
- liats[x] = y;
- liats[y] = x;
- }
- else {
- cout << "COUPLES:" << endl;
- for (ite it = liats.begin(); it != liats.end(); ++it)
- if (it->second != "" and it->first < it->second)
- cout << it->first << " " << it->second << endl;
- cout << "ALONE:" << endl;
- for (ite it = liats.begin(); it != liats.end(); ++it)
- if (it->second == "")
- cout << it->first << endl;
- cout << "----------" << endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement