forked from vedantpople4/problem_solving_cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path476A.cpp
More file actions
57 lines (53 loc) · 1.26 KB
/
476A.cpp
File metadata and controls
57 lines (53 loc) · 1.26 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <bits/stdc++.h>
using namespace std;
int main()
{
int i,j;
char c,s[100],s1[]= {'q','w','e','r','t','y','u','i','o','p'},s2[]= {'a','s','d','f','g','h','j','k','l',';'},s3[]= {'z','x','c','v','b','n','m',',','.','/'};
scanf("%c",&c);
scanf("%s",s);
if(c=='L')
{
for(i=0; i<=strlen(s); i++)
{
for(j=9; j>=0; j--)
{
if(s[i]==s1[j])
{
s[i]=s1[j+1];
}
else if(s[i]==s2[j])
{
s[i]=s2[j+1];
}
else if(s[i]==s3[j])
{
s[i]=s3[j+1];
}
}
}
}
else if(c=='R')
{
for(i=0; i<strlen(s); i++)
{
for(j=0; j<10; j++)
{
if(s[i]==s1[j])
{
s[i]=s1[j-1];
}
else if(s[i]==s2[j])
{
s[i]=s2[j-1];
}
else if(s[i]==s3[j])
{
s[i]=s3[j-1];
}
}
}
}
printf("%s\n",s);
return 0;
}