fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. const int MAX_LENGTH = 2000;
  6.  
  7. int main() {
  8. char array[2000];
  9. char index [25] = "abcdefghijklzyxwvutsrqpo";
  10. while (cin.getline(array, MAX_LENGTH)) {
  11. int length = strlen(array);
  12. for (int i = 0; i < length; ++i) {
  13. array[i] = tolower(array[i]);
  14. }
  15. for (int i = 0; i < length; ++i) {
  16. int flag = 1;
  17. char aux ;
  18. if (array[i] == 'a') {
  19. cout << "1";
  20. flag = 0;
  21. }else if (array[i] == 'e') {
  22. cout << "2";
  23. flag = 0;
  24. } else if (array[i] == 'i') {
  25. cout << "3";
  26. flag = 0;
  27. } else if (array[i] == 'o') {
  28. cout << "4";
  29. flag = 0;
  30. } else if (array[i] == 'u') {
  31. cout << "5";
  32. flag = 0;
  33. }
  34. if (array[i] < 'a') {
  35. cout << array[i] ;
  36. }
  37. if (flag == 1) {
  38. aux = array[i] ;
  39. if (array[i] >= 'a' && array[i] <= 'l') {
  40. for (int i = 0; i < 24; ++i) {
  41. if (aux == index[i]) {
  42. cout << index[i + 12];
  43. flag = 0;
  44. }
  45. }
  46. } else if (array[i] >= 'o' && array[i] <= 'z') {
  47. for (int i = 0; i < 24; ++i) {
  48. if (aux == index[i]) {
  49. cout << index[i - 12];
  50. flag = 0;
  51. }
  52. }
  53. } else if (array[i] == 'm') {
  54. cout << "n" ;
  55. }else if (array[i] == 'n') {
  56. cout << "m";
  57. }
  58. }
  59. }
  60. cout << "\n";
  61. }
  62.  
  63. return 0;
  64. }
  65.  
Success #stdin #stdout 0.01s 5296KB
stdin
zazaza

qqqq

Ieri am vaZUT UN!!  oZneu pe. CER CARE
ZBUra foarte S-US si nu am putuT 
obserVA ARIPILE sale, ce erAU, FOarte... micute
stdout
a1a1a1

jjjj

32i3 1n e1a5g 5m!!  4am25 k2. x2i x1i2
ay5i1 u41ig2 h-5h h3 m5 1n k5g5g 
4yh2ie1 1i3k3o2 h1o2, x2 2i15, u41ig2... n3x5g2