Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cstdlib>
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <string.h>
- #include <algorithm>
- #include <math.h>
- using namespace std;
- int main()
- {
- freopen("input.txt","r", stdin);
- freopen("output.txt", "w",stdout);
- char n, *f;
- cin>>n;
- string s;
- cin>>s;
- int k;
- if (n == 'R')
- k = 1;
- else
- k = -1;
- string s1[12] = "1qwertyuiopq";
- string s2[12] = "1asdfghjkl;a";
- string s3[12] = "1zxcvbnm,./z";
- for (int i = 0; i<s.length(); i++)
- {
- if (k==-1)
- {
- if (s[i] == 'q')
- cout<<'p';
- if (s[i] == 'a')
- cout<<';';
- if (s[i] == 'z')
- cout<<'/';
- continue;
- }
- *f = strchr(s1,s[i])
- if (f-s1+1 != 0)
- cout<<s1[f-s1+1+k];
- *f = strchr(s2,s[i])
- if (f-s2+1 != 0)
- cout<<s2[f-s2+1+k];
- *f = strchr(s3,s[i])
- if (f-s3+1 != 0)
- cout<<s3[f-s3+1+k];
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement