题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
#include <iostream> #include <string> #include <map> using namespace std; int main() { string input; cin >> input; string dict = "22233344455566677778889999"; string output; for (char c: input) { if (c >= 'a' && c <= 'z') output += dict[c-'a']; else if (c >= 'A' && c <= 'Z') output += (char)('a' + (c-'A'+1)%26); else output += c; } cout << output; } // 64 位输出请用 printf("%lld")