题解 | #密码翻译#
密码翻译
https://www.nowcoder.com/practice/136de4a719954361a8e9e41c8c4ad855
#include "cstdio" #include "string" #include "iostream" using namespace std; int main() { string str; while (getline(cin, str)) { for (int i = 0; i < str.size(); ++i) { if (str[i] == 'z' || str[i] == 'Z') { str[i] -= 25; } else if ((str[i] >= 'a' && str[i] <= 'y') || (str[i] >= 'A' && str[i] <= 'Y')) { str[i] = str[i] + 1; } } cout << str << endl; } }