artemgf

Легко взломать!

Apr 16th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <string>
  4. #include <math.h>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <set>
  8. #include <sstream>
  9.  
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14.     string s, answer = "";
  15.  
  16.     cin >> s;
  17.  
  18.     int prom;
  19.     if (s[0] >= 'A'&& s[0] <= 'Z')
  20.     {
  21.         prom = s[0] - 65;
  22.         if (prom - 5 < 0)
  23.             answer += s[0] + 21;
  24.         else
  25.             answer += s[0] - 5;
  26.     }
  27.     else
  28.     {
  29.         prom = s[0] - 97;
  30.         if (prom - 5 < 0)
  31.             answer += s[0] + 21;
  32.         else
  33.             answer += s[0] - 5;
  34.     }
  35.     for (int i = 1; i <= s.size() - 1; i++)
  36.     {
  37.         if (s[i] >= 'A'&& s[i] <= 'Z')
  38.         {
  39.             if (s[i] - prom < 65)
  40.                 answer += s[i] - prom + 26;
  41.             else
  42.                 answer += s[i] - prom;
  43.             prom = s[i] - 65;
  44.         }
  45.         else
  46.         {
  47.             if (s[i] - prom < 97)
  48.                 answer += s[i] - prom + 26;
  49.             else
  50.                 answer += s[i] - prom;
  51.             prom = s[i] - 97;
  52.         }
  53.            
  54.     }
  55.  
  56.     cout << answer;
  57.  
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment