POJ 1298 The Hardest Problem Ever
1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 int main() 5 { 6 char s1[110]; 7 char s2[15]; 8 int i,n; 9 while(1) 10 { 11 gets(s2); 12 if(strcmp(s2,"ENDOFINPUT")==0) 13 break; 14 else if(strcmp(s2,"START")==0) 15 { 16 gets(s1); 17 n=strlen(s1); 18 for(i=0;i<n;i++) 19 { 20 if(s1[i]>='A'&&s1[i]<='Z') 21 { 22 s1[i]='A'+(s1[i]-'A'-5+26)%26; 23 } 24 } 25 } 26 else if(strcmp(s2,"END")==0) 27 printf("%s\n",s1); 28 } 29 system("pause"); 30 return 0; 31 } 32