Advertisement
OIQ

Untitled

OIQ
Oct 5th, 2021
787
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None
  1. #include <string>
  2. #include <iostream>
  3.  
  4. int main() {
  5.     std::string alp(26, ' ');
  6.     for (int i = 0; i < 26; i++) {
  7.         alp[i] = static_cast<char>('A' + i);
  8.     }
  9.  
  10.     std::string str = "UII QUXSCUQCVPACFULQVCXFCHIICBIAHQ LAQ";
  11.     std::string result;
  12.     for (size_t i = 0; i < str.size(); i++) {
  13.         int y = str[i] == ' ' ? 26 : str[i] - 'A';
  14.         int x = (11 * (y - 7)) % 27;
  15.         if (x < 0) {
  16.             x = 27 + x;
  17.         }
  18.  
  19.         result += x == 26 ? ' ' : alp[x];
  20.     }
  21.  
  22.     std::cout << result;
  23. }
Advertisement
RAW Paste Data Copied
Advertisement