Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- using namespace std;
- int main()
- {
- string line, name, id;
- map<string, string> companies;
- while (true) {
- getline(cin, line);
- if (line == "end") {
- break;
- }
- name = line.substr(0, line.find(' '));
- id = line.substr(line.find(' ') + 1);
- companies.insert({ id, name });
- }
- for (auto& c : companies ) {
- cout << c.second << ' ' << c.first << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement