Result: Accepted
Time: 3ms
Memory: 1756kB
#include <cstdio>
#include <iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<cstring>
using namespace std;
double n,m;
int i,j,k;
char s[114];
int main()
{
while(scanf("%s",s)!=EOF){
int len=strlen(s);
int kk='a'-'A';
for(i=0;i<len;++i)
{
if((s[i]>='0'&&s[i]<='9')||(s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
{
if(s[i]>='0'&&s[i]<='9')
printf("%c",s[i]);
if(s[i]=='a'||s[i]=='b'||s[i]=='c')
printf("2");
if(s[i]=='d'||s[i]=='e'||s[i]=='f')
printf("3");
if(s[i]=='g'||s[i]=='h'||s[i]=='i')
printf("4");
if(s[i]>='j'&&s[i]<='j'+2)
printf("5");
if(s[i]>='m'&&s[i]<='m'+2)
printf("6");
if(s[i]>='p'&&s[i]<='p'+3)
printf("7");
if(s[i]>='t'&&s[i]<='t'+2)
printf("8");
if(s[i]>='w'&&s[i]<='z')
printf("9");
if(s[i]>='A'&&s[i]<='Z')
{
if(s[i]=='Z')
printf("a");
else
printf("%c",s[i]+kk+1);
}
}
else
printf("%c",s[i]);
}printf("\n");
}
return 0;
}