#include <iostream> #include <string> #include <cstdio> using namespace std; int main() { string start, str, end; while (getline(cin,str)) { if (start == "ENDOFINPUT") { break; } getline(cin, str); for (int i = 0; i < str.size(); i++) { if (str[i] <= 'Z' && str[i] >= 'A') { str[i] = 'A' + ((str[i] - 'A' - 5) + 26) % 26; } } cout << str << endl; cin >> end; } return 0; } // 64 位输出请用 printf("%lld")
cin>>str
换行不算字符串结尾,只有空格才算结尾
getline(cin,str)换行才算结尾