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