Advertisement
double_trouble

Untitled

Oct 6th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.09 KB | None | 0 0
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <iostream>
  4. #include <vector>
  5. #include <cstring>
  6. #include <string.h>
  7. #include <algorithm>
  8. #include <math.h>
  9.  
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14.    freopen("input.txt","r", stdin);
  15.    freopen("output.txt", "w",stdout);
  16.    char n, *f;
  17.    cin>>n;
  18.    string s;
  19.    cin>>s;
  20.    int k;
  21.    if (n == 'R')
  22.     k = 1;
  23.    else
  24.     k =  -1;
  25.    string s1[12] = "1qwertyuiopq";
  26.    string s2[12] = "1asdfghjkl;a";
  27.    string s3[12] = "1zxcvbnm,./z";
  28.    for (int i = 0; i<s.length(); i++)
  29.     {
  30.         if (k==-1)
  31.             {
  32.                 if (s[i] == 'q')
  33.                     cout<<'p';
  34.                 if (s[i] == 'a')
  35.                     cout<<';';
  36.                 if (s[i] == 'z')
  37.                     cout<<'/';
  38.                 continue;
  39.             }
  40.         *f = strchr(s1,s[i])
  41.         if (f-s1+1 != 0)
  42.             cout<<s1[f-s1+1+k];
  43.         *f = strchr(s2,s[i])
  44.         if (f-s2+1 != 0)
  45.             cout<<s2[f-s2+1+k];
  46.         *f = strchr(s3,s[i])
  47.         if (f-s3+1 != 0)
  48.             cout<<s3[f-s3+1+k];
  49.     }
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement