Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <math.h>
  5. #include <cmath>
  6. #include <algorithm>
  7. #include <stack>
  8. #include <fstream>
  9. using std ::cin;
  10. using std ::cout;
  11. using std ::string;
  12. int perevod (char cc) {
  13.     if (cc - '0' <= 9) {
  14.        return cc - '0';
  15.     } else {
  16.         return cc - '0' - 39;
  17.     }
  18. }
  19.  
  20. int main() {
  21.     // std::string name = "/home/rasull/CONTESTS/equatation.in";
  22.     // fstream input(name, input.in);
  23.     // std ::ifstream in("/home/rasull/CONTESTS/tree.in");
  24.     // std ::ofstream out("/home/rasull/CONTESTS/tree.out");
  25.     char next;
  26.     int kk = 0, now = 0;
  27.     string ss = "";
  28.     while ((next = cin.get()) != EOF) {
  29.         ss += next;
  30.         if (!((next >= 65 && next <= 90) || (next >= 97 && next <= 122))) {
  31.             if (now > kk) {
  32.                 kk = now;
  33.             }
  34.             now = 0;
  35.         } else {
  36.             ++now;
  37.         }
  38.     }
  39.     for (int ii = 0; ii < ss.size(); ++ii) {
  40.         if ((ss[ii] >= 65 && ss[ii] <= 90)) {
  41.             ss[ii] = static_cast<char>((ss[ii] - 65 + kk) % 26 + 65);
  42.         } else if ((ss[ii] >= 97 && ss[ii] <= 122)) {
  43.             ss[ii] = static_cast<char>((ss[ii] - 97 + kk) % 26 + 97);
  44.         }
  45.     }
  46.     cout << ss;
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement