Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<math.h>
  4. #define SIZE 265
  5.  
  6. using namespace std;
  7.  
  8. char s[SIZE];
  9. char c[27];
  10.  
  11. int main()
  12. {
  13. freopen("input.txt","r",stdin);
  14. freopen("output.txt","w",stdout);
  15.  
  16. for(int i = 0; i < 10; i++)
  17. c[i] = char(i+'0');
  18. for(int i = 0; i < 27; i++)
  19. c[i+10] = char(i+'A');
  20.  
  21. char val[27];
  22. for(int i = 0; i < 26; i++)
  23. val[i] = char(i+'a');
  24. val[26] = ' ';
  25.  
  26. cin >> s;
  27.  
  28. int n = strlen(s);
  29.  
  30. for(int i = 0; i < n; i++)
  31. {
  32. int p = 0;
  33.  
  34. while((c[p] != s[i]) && (p < 26))
  35. p++;
  36.  
  37. int pos = (p-2-i)%27;
  38. if(pos < 0) pos += 27;
  39. cout << val[pos];
  40. }
  41.  
  42. cout << "\n";
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement