Advertisement
Guest User

Untitled

a guest
Jan 11th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. string word, good_word, word_2;
  8. cin >> word;
  9. good_word = word[0];
  10. for (char s : word) {
  11. if (s == 'a' || s == 'e' || s == 'h' || s == 'i' || s == 'o' || s == 'u') {
  12. continue;
  13. } else if (s == 'w' || s == 'y') {
  14. continue;
  15. } else if (s == 'b' || s == 'f' || s == 'p' || s == 'v') {
  16. good_word += '1';
  17. } else if (s == 'c' || s == 'g' || s == 'j' || s == 'k') {
  18. good_word += '2';
  19. } else if (s == 'q' || s == 's' || s == 'x' || s == 'z') {
  20. good_word += '2';
  21. } else if (s == 'd' || s == 't') {
  22. good_word += '3';
  23. } else if (s == 'l') {
  24. good_word += '4';
  25. } else if (s == 'm' || s == 'n') {
  26. good_word += '5';
  27. } else if (s == 'r') {
  28. good_word += '6';
  29. }
  30. if (good_word[good_word.size() - 1] == good_word[good_word.size() - 2]) {
  31. good_word.erase(good_word.size() - 1, good_word.size());
  32. }
  33. }
  34. if (good_word.size() < 4) {
  35. while (good_word.size() < 4) {
  36. good_word += '0';
  37. }
  38. cout << good_word;
  39. } else {
  40. good_word.erase(4, good_word.size());
  41. cout << good_word;
  42. }
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement