fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string vowels = "aiueo";
  6. string elms[26] = {
  7. "mn", "si", "v", "ca", "he",
  8. "mo", "na", "mg", "se", "sb",
  9. "nb", "rf", "cs", "te", "lr",
  10. "ti", "cr", "sc", "ge", "ne",
  11. "as", "tc", "ga", "p", "fe", "zn"};
  12.  
  13. //menhera-encrypt
  14. int main() {
  15. while(true) {
  16. string s, buf1, buf2, res1, res2;
  17. if (cin.eof()) break;
  18. cin >> s;
  19.  
  20. for(int i = 0; i < s.size(); ++i) {
  21. if (vowels.find(s[i]) != string::npos) {
  22. buf1 += {'a'};
  23. buf2 += {s[i]};
  24. } else {
  25. buf1 += {s[i]};
  26. buf2 += {s[++i]};
  27. }
  28. }
  29.  
  30.  
  31. int count = 1;
  32. res1 += elms[buf1[0] - 'a'];
  33. for(int i = 1; i < buf1.size(); ++i) {
  34. if(buf1[i] != buf1[i - 1]) {
  35. if(count > 1)
  36. res1 += to_string(count);
  37. count = 1;
  38. res1 += elms[buf1[i] - 'a'];
  39. } else {
  40. ++count;
  41. }
  42. }
  43. if(count > 1)
  44. res1 += to_string(count);
  45.  
  46.  
  47. count = 1;
  48. res2 += elms[buf2[0] - 'a'];
  49. for(int i = 1; i < buf2.size(); ++i) {
  50. if(buf2[i] != buf2[i - 1]) {
  51. if(count > 1)
  52. res2 += to_string(count);
  53. count = 1;
  54. res2 += elms[buf2[i] - 'a'];
  55. } else {
  56. ++count;
  57. }
  58. }
  59. if(count > 1)
  60. res2 += to_string(count);
  61.  
  62. cout << res2 << res1 << endl;
  63. }
  64. }
Success #stdin #stdout 0.01s 5312KB
stdin
nennnainiisakuwotukurutumoridesu
stdout
hetemnse3mnaslras4lrseheaste3mntemngenbganenbscnecssccage