-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy path474A - Keyboard.cpp
39 lines (38 loc) · 918 Bytes
/
474A - Keyboard.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long i,j,d,ans;
string s,s1,s2,s3;
char p;
s1="qwertyuiop";
s2="asdfghjkl;";
s3="zxcvbnm,./";
while(cin>>p>>s){
if(p=='R')
d=-1;
else
d=1;
for(i=0;i<s.size();i++){
for(j=0;j<s1.size();j++){
if(s[i]==s1[j]){
s[i]=s1[j+d];
break;
}
}
for(j=0;j<s2.size();j++){
if(s[i]==s2[j]){
s[i]=s2[j+d];
break;
}
}
for(j=0;j<s3.size();j++){
if(s[i]==s3[j]){
s[i]=s3[j+d];
break;}
}
}
cout<<s<<endl;
}
return 0;
}