Advertisement
fooker

ROT13

Nov 27th, 2022
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. // ROT13 encoder && decrypter
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int main()
  5. {
  6.     string s;
  7.     cin>>s;
  8.     for (int i=0; i<s.length(); i++){
  9.         s[i]=(s[i]==96+13)?((((s[i]-96)+13)%26)+96+26):((((s[i]-96)+13)%26)+96);
  10.     }
  11.     cout<<s;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement