Advertisement
myloyo

d задача

Jul 6th, 2023
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include <string>
  5. #include <algorithm>
  6. #include <set>
  7. #include <list>
  8. #include <sstream>
  9. #include <vector>
  10. #include <map>
  11. #include <stdlib.h>
  12.  
  13. using namespace std;
  14. ifstream in("input.txt");
  15. ofstream out("output.txt");
  16.  
  17.  
  18. int main() {
  19. string h;
  20. int n;
  21. string alph = "";
  22. for (char i = 'a'; i < 'z'; i++) {
  23. alph += i;
  24. }
  25. cin >> n >> h;
  26. string j = "";
  27. for (int i = 0; i < n-2; i++) {
  28. if (h[i + 2] == '0' && (i+2) < n) {
  29. string x(1, h[i]);
  30. string k(1, h[i + 1]);
  31. int c = stoi(x + k);
  32. j += alph[c - 1];
  33. i+=2;
  34. }
  35. else {
  36. string x(1, h[i]);
  37. int c = stoi(x);
  38. j += alph[c - 1];
  39. }
  40. }
  41. cout << j << endl;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement