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