UVa10082

題目:
https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=12&page=show_problem&problem=1023

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
#include <bits/stdc++.h>
using namespace std;

int main(){
ios::sync_with_stdio(0);
cin.tie(0);

char words[] = {"``1234567890-=QQWERTYUIOP[]\\AASDFGHJKL;\'ZZXCVBNM,./"};

string text;
while(getline(cin, text)){
for(int i=0; i<text.length(); ++i){
char word = text[i];
if(word == ' '){
cout << ' ';
continue;
}
char newword;
for(int j=0; j<52; ++j){
if(words[j] == word){
newword = words[j-1];
break;
}
}
cout << newword;
}
cout << '\n';
}

return 0;
}