Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. /************************
  2.  **  Solution by daun  **
  3.  ***********************/
  4.  
  5. #include <bits/stdc++.h>
  6.  
  7. using namespace std;
  8.  
  9. const int N = 200005;
  10. const int INF = 4127;
  11. const int mod = 475;
  12. string a1 = "qwertyuiop", a2 = "asdfghjkl;", a3 = "zxcvbnm,./";
  13.  
  14. int main() {
  15.     string n, s;
  16.     cin >> n >> s;
  17.     if (n[0] == 'R') {
  18.         for (int i = 0; i < s.size(); i++) {
  19.             if (a1.find(s[i]) != string::npos) {
  20.                 cout << a1[a1.find(s[i]) - 1];
  21.                 continue;
  22.             }
  23.             if (a2.find(s[i]) != string::npos) {
  24.                 cout << a2[a2.find(s[i]) - 1];
  25.                 continue;
  26.             }
  27.             if (a3.find(s[i]) != string::npos) {
  28.                 cout << a3[a3.find(s[i]) - 1];
  29.             }
  30.         }
  31.     } else {
  32.         for (int i = 0; i < s.size(); i++) {
  33.             if (a1.find(s[i]) != string::npos) {
  34.                 cout << a1[a1.find(s[i]) + 1];
  35.                 continue;
  36.             }
  37.             if (a2.find(s[i]) != string::npos) {
  38.                 cout << a2[a2.find(s[i]) + 1];
  39.                 continue;
  40.             }
  41.             if (a3.find(s[i]) != string::npos) {
  42.                 cout << a3[a3.find(s[i]) + 1];
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement