题解 | #密码翻译#
密码翻译
https://www.nowcoder.com/practice/136de4a719954361a8e9e41c8c4ad855
#include <iostream> #include <string> using namespace std; char pwd[90]; int main() { //Hello! How are you! string str; while (fgets(pwd, 90, stdin)) { // 注意 while 处理多个 case str = pwd; for (int i = 0; i < str.size(); i++) { if (str[i] >= 'a' && str[i] <= 'y' || str[i] >= 'A' && str[i] <= 'Y') { str[i] += 1; } else if (str[i] == 'z') { str[i] = 'a'; } else if (str[i] == 'Z') { str[i] = 'A'; } else { continue; } } printf("%s\n", str.c_str()); } } // 64 位输出请用 printf("%lld")