Result: Accepted
Time: 3ms
Memory: 1120kB
#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
char str[100];
int len;
while(scanf("%s",str)!=EOF){
len=strlen(str);
for(int i=0;i<len;i++){
if(str[i]>='A'&&str[i]<'Z')
str[i]+=33;
else if(str[i]=='Z') str[i]='a';
else if(str[i]>='a'&&str[i]<='z'){
if(str[i]>='a'&&str[i]<='c')
str[i]='2';
else if(str[i]>='d'&&str[i]<='f')
str[i]='3';
else if(str[i]>='g'&&str[i]<='i')
str[i]='4';
else if(str[i]>='j'&&str[i]<='l')
str[i]='5';
else if(str[i]>='m'&&str[i]<='o')
str[i]='6';
else if(str[i]>='p'&&str[i]<='s')
str[i]='7';
else if(str[i]>='t'&&str[i]<='v')
str[i]='8';
else if(str[i]>='w'&&str[i]<='z')
str[i]='9';
}
}
for(int j=0;j<len;j++){
printf("%c",str[j]);
}
printf("\n");
memset(str,0,sizeof str);
}
return 0;
}