Run ID:117311

提交时间:2025-04-16 20:31:36

#include <iostream> #include <string> using namespace std; int main() { string input; getline(cin, input); // 读取一行输入 // 遍历字符串,进行加密处理 for (char &c : input) { if (c >= 'a' && c < 'z') { c++; // 小写字母a-y,替换为后继字母 } else if (c == 'z') { c = 'a'; // 小写字母z,替换为a } else if (c >= 'A' && c < 'Z') { c++; // 大写字母A-Y,替换为后继字母 } else if (c == 'Z') { c = 'A'; // 大写字母Z,替换为A } // 其他非字母字符保持不变 } // 输出加密后的字符串 cout << input << endl; return 0; }