http://acm.hdu.edu.cn/showproblem.php?pid=1048
//字符串 #include <iostream> #include <cstring> using namespace std; int main() { char oper[11]; char str[255]; int i, j; while (scanf("%s%*c", oper)) { if (strcmp(oper,"START") == 0) { gets(str); if (strcmp(str,"END") == 0) continue; else { for (i = 0; i <(int) strlen(str); i++) { if (isalpha(str[i])) { j = str[i] - 'A'; str[i] = ((j >= 5) ? 'A'+j-5 : 'A'+26+j-5); } } } cout << str << endl; } if (strcmp(oper,"ENDOFINPUT") == 0) break; } return 0; }