Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <map>
- #include <algorithm>
- using namespace std;
- int main() {
- map <int, string> table = { {0, "oqz"}, {1, "ij"}, {2, "abc"}, {3, "def"}, {4, "gh"}, {5, "kl"}, {6, "mn"}, {7, "prs"}, {8, "tuv"}, {9, "wxy"}};
- string numb = "0"; int n;
- while (cin >> numb && numb != "-1") {
- cin >> n;
- map <vector <int>, string> eqv; vector <int> converted; string s;
- for (int in = 1; in <= n; in++) {
- cin >> s;
- for (int i = 0; i < s.size(); i++)
- for (int itbl = 0; itbl <= 9; itbl++)
- if (find(table[itbl].begin(), table[itbl].end(), s[i]) != table[itbl].end())
- converted.push_back(s[i]);
- eqv[converted] = s;
- }
- for (auto it = eqv.begin(); it != eqv.end(); it++)
- cout << it->second << '\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment