Guest User

Untitled

a guest
Jul 18th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <map>
  5. #include <algorithm>
  6. using namespace std;
  7. int main() {
  8. map <int, string> table = { {0, "oqz"}, {1, "ij"}, {2, "abc"}, {3, "def"}, {4, "gh"}, {5, "kl"}, {6, "mn"}, {7, "prs"}, {8, "tuv"}, {9, "wxy"}};
  9. string numb = "0"; int n;
  10. while (cin >> numb && numb != "-1") {
  11. cin >> n;
  12. map <vector <int>, string> eqv; vector <int> converted; string s;
  13. for (int in = 1; in <= n; in++) {
  14. cin >> s;
  15. for (int i = 0; i < s.size(); i++)
  16. for (int itbl = 0; itbl <= 9; itbl++)
  17. if (find(table[itbl].begin(), table[itbl].end(), s[i]) != table[itbl].end())
  18. converted.push_back(s[i]);
  19. eqv[converted] = s;
  20. }
  21.  
  22. for (auto it = eqv.begin(); it != eqv.end(); it++)
  23. cout << it->second << '\n';
  24.  
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment