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