#include <iostream> #include <cstdio> #include <algorithm> #include <string> using namespace std; //A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 密文 //V W X Y Z A B C D E F G H I J K L M N O P Q R S T U 明文 //复习ASCII码表 //数字和字母的起始值(0:48, A:65, a:97)。空格:32 逗号(,)的十进制值是 44 string s, e, str; int main() { while (getline(cin, s)) {//若while (cin >> s),会出现缓冲区残留换行符 if (s == "ENDOFINPUT") { break; } else { getline(cin, str); cin >> e; for (int i = 0; i < str.size(); i++) { //只有ASCII码的值大于等于65时需要转换 if (str[i] >= 65) { if (str[i] == 'A') str[i] = 'V'; else if (str[i] == 'B') str[i] = 'W'; else if (str[i] == 'C') str[i] = 'X'; else if (str[i] == 'D') str[i] = 'Y'; else if (str[i] == 'E') str[i] = 'Z'; else str[i] -= 5; } } } cout << str << endl; } return 0; }