题解 | #简单密码# C++硬解
简单密码
http://www.nowcoder.com/practice/7960b5038a2142a18e27e4c733855dac
#include<iostream>
#include<string>
using namespace std;
int main()
{
string str;
while(cin>>str)
{
for(auto &x:str)
{
if(x=='a'||x=='b'||x=='c') x='2';
else if(x=='d'||x=='e'||x=='f') x='3';
else if(x=='g'||x=='h'||x=='i') x='4';
else if(x=='j'||x=='k'||x=='l') x='5';
else if(x=='m'||x=='n'||x=='o') x='6';
else if(x=='p'||x=='q'||x=='r'||x=='s') x='7';
else if(x=='t'||x=='u'||x=='v') x='8';
else if(x=='w'||x=='x'||x=='y'||x=='z') x='9';
else if(x>='A'&&x<'Z') x=x+('a'-'A')+1;
else if(x=='Z') x='a';
}
cout<<str<<endl;
}
}