Result: Accepted
Time: 3ms
Memory: 1120kB
#include<stdio.h>
#include<math.h>
#include<string.h>
int main(){
int n,m,k,j,l,i,p;
char str[10100],str1[1000];
while(gets(str)!=NULL){
k=strlen(str);
l=0;
for(i=0;i<k;i++){
if(str[i]>='a'&&str[i]<='z'){
if(str[i]=='a'||str[i]=='b'||str[i]=='c'){
str1[l]='2';l++;}
else if(str[i]=='d'||str[i]=='e'||str[i]=='f'){
str1[l]='3';l++;}
else if(str[i]=='g'||str[i]=='h'||str[i]=='i'){
str1[l]='4';l++;}
else if(str[i]=='j'||str[i]=='k'||str[i]=='l'){
str1[l]='5';l++;}
else if(str[i]=='m'||str[i]=='n'||str[i]=='o'){
str1[l]='6';l++;}
else if(str[i]=='p'||str[i]=='q'||str[i]=='r'||str[i]=='s'){
str1[l]='7';l++;}
else if(str[i]=='t'||str[i]=='u'||str[i]=='v'){
str1[l]='8';l++;}
else if(str[i]=='w'||str[i]=='x'||str[i]=='y'||str[i]=='z'){
str1[l]='9';l++;}
}
else if(str[i]>='A'&&str[i]<='Z'){
if(str[i]=='A')
{str1[l]='b';l++;}
if(str[i]=='B')
{str1[l]='c';l++;}
if(str[i]=='C')
{str1[l]='d';l++;}
if(str[i]=='D')
{str1[l]='e';l++;}
if(str[i]=='E')
{str1[l]='f';l++;}
if(str[i]=='F')
{str1[l]='g';l++;}
if(str[i]=='G')
{str1[l]='h';l++;}
if(str[i]=='H')
{str1[l]='i';l++;}
if(str[i]=='I')
{str1[l]='j';l++;}
if(str[i]=='J')
{str1[l]='k';l++;}
if(str[i]=='K')
{str1[l]='l';l++;}
if(str[i]=='L')
{str1[l]='m';l++;}
if(str[i]=='M')
{str1[l]='n';l++;}
if(str[i]=='N')
{str1[l]='o';l++;}
if(str[i]=='O')
{str1[l]='p';l++;}
if(str[i]=='P')
{str1[l]='q';l++;}
if(str[i]=='Q')
{str1[l]='r';l++;}
if(str[i]=='R')
{str1[l]='s';l++;}
if(str[i]=='S')
{str1[l]='t';l++;}
if(str[i]=='T')
{str1[l]='u';l++;}
if(str[i]=='U')
{str1[l]='v';l++;}
if(str[i]=='V')
{str1[l]='w';l++;}
if(str[i]=='W')
{str1[l]='x';l++;}
if(str[i]=='X')
{str1[l]='y';l++;}
if(str[i]=='Y')
{str1[l]='z';l++;}
if(str[i]=='Z')
{str1[l]='a';l++;}
}
else{
str1[l]=str[i];
l++;
}
}
str[l-1]='\0';
for(i=0;i<l;i++){
printf("%c",str1[i]);
}
printf("\n");
for(i=0;i<l;i++){
str1[i]='\0';
}
}
return 0;
}