题目1093:WERTYU
View Code
1 #include<iostream> 2 #include<string> 3 #include<string.h> 4 using namespace std; 5 6 string standard="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./"; 7 string s; 8 char replace[128]; 9 10 11 void Init() 12 { 13 int i,j=0,temp; 14 15 for(i=1;i<standard.size();++i) 16 { 17 temp=standard[i]; 18 replace[temp]=standard[i-1]; 19 } 20 replace[' ']=' '; 21 } 22 23 int main() 24 { 25 int i; 26 Init(); 27 char c; 28 while(getline(cin,s)) 29 { 30 //c=getchar(); 31 for(i=0;i<s.size();++i) 32 { 33 cout<<replace[s[i]]; 34 } 35 cout<<endl; 36 } 37 return 0; 38 }