POJ 2538
#include<string> //#include #include<stdio.h> #include<iostream> using namespace std; char map[]={'`','1','2','3','4','5','6','7','8','9','0','-','=','Q','W','E','R','T','Y','U','I','O','P','[',']','\\','A','S','D','F','G','H','J','K','L',';','\'','Z','X','C','V','B','N','M',',','.','/'}; int main() { //freopen("acm.acm","r",stdin); string s; string s1; int pos; int i; for(i = 0; i < strlen(map); ++ i) { s += map[i]; } while(getline(cin,s1)) { for(i = 0; i < s1.length(); ++ i) { if(s1[i] != ' ') { pos = s.find(s1[i]); cout<<s[pos-1]; } else cout<<s1[i]; } cout<<endl; } }