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