-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Keyboard.cpp
More file actions
47 lines (39 loc) · 778 Bytes
/
Copy pathA_Keyboard.cpp
File metadata and controls
47 lines (39 loc) · 778 Bytes
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
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
#define endl '\n';
void solve()
{
char ch; cin >>ch;
string s; cin >>s;
unordered_map<char,char> mp;
string q = "qwertyuiopasdfghjkl;zxcvbnm,./";
if (ch == 'R')
{
for (int i = 1; i < q.length(); i++)
{
char temp = q[i];
mp[temp] = q[i-1];
}
}
else if(ch == 'L')
{
for (int i = 0; i < q.length()-1; i++)
{
char temp = q[i];
mp[temp] = q[i+1];
}
}
for (int i = 0; i < s.length(); i++)
{
cout<<mp[s[i]];
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
solve();
return 0;
}