题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
#include <iostream> using namespace std; char change(char c){ if(c>='a'&&c<='c')return '2'; if(c>='d'&&c<='f')return '3'; if(c>='g'&&c<='i')return '4'; if(c>='j'&&c<='l')return '5'; if(c>='m'&&c<='o')return '6'; if(c>='p'&&c<='s')return '7'; if(c>='t'&&c<='v')return '8'; if(c>='w'&&c<='z')return '9'; if(c>='A'&&c<='Y')return c+32+1; if(c=='Z')return 'a'; return c; } int main() { char c; while (cin>>c) { // 注意 while 处理多个 case cout<<change(c); } } // 64 位输出请用 printf("%lld")