有点打脑壳,总之。。。。就是把九宫格密码给解出来
#include <cstring>
#include <iostream>
using namespace std;
string get_T9(int n){
string caps[]={" ","@","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"},rt;
if(n==0||n==1) rt=caps[n];
else{
rt=caps[n/10][n%10-1];
}
return rt;
}
int main(){
string inp,show;
cin>>inp;
int len=inp.length();
int step=0,p=0;
while(p<len){
if(inp[p]-'0'>1){
step=(inp[p]-'0')*10+(inp[++p]-'0');
}else{
step=(inp[p]-'0');
}
show+=get_T9(step);
p++;
}
cout<<show<<endl;
}