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