Problem Type : String
#include<stdio.h>
#include<string.h>
int main()
{
int i;
char ch[1000];
while(gets(ch))
{
for(i=0; ch[i]!='\0'; i++)
{
if(ch[i]==' ')
printf(" ");
else if(ch[i]=='/')
printf(",",ch[i]);
else if(ch[i]=='.')
{
printf("m",ch[i]);
}
else if(ch[i]==',')
{
printf("n",ch[i]);
}
else if(ch[i]=='m'|| ch[i]=='M')
{
printf("b",ch[i]);
}
else if(ch[i]=='n'|| ch[i]=='N')
{
printf("v",ch[i]);
}
else if(ch[i]=='b'|| ch[i]=='B')
{
printf("c",ch[i]);
}
else if(ch[i]=='v'|| ch[i]=='V')
{
printf("x",ch[i]);
}
else if(ch[i]=='c'|| ch[i]=='C')
{
printf("z",ch[i]);
}
else if(ch[i]=='x'|| ch[i]=='X')
{
ch[i]=92;
printf("%c",ch[i]);
}
else if(ch[i]=='z'|| ch[i]=='Z')
{
printf("'",ch[i]);
}
else if(ch[i]==39)
{
printf("l",ch[i]);
}
else if(ch[i]==';')
{
printf("k",ch[i]);
}
else if(ch[i]=='l'|| ch[i]=='L')
{
printf("j",ch[i]);
}
else if(ch[i]=='k'|| ch[i]=='K')
{
printf("h",ch[i]);
}
else if(ch[i]=='j'|| ch[i]=='J')
{
printf("g",ch[i]);
}
else if(ch[i]=='h'|| ch[i]=='H')
{
printf("f",ch[i]);
}
else if(ch[i]=='g'|| ch[i]=='G')
{
printf("d",ch[i]);
}
else if(ch[i]=='f'|| ch[i]=='F')
{
printf("s",ch[i]);
}
else if(ch[i]=='d'|| ch[i]=='D')
{
printf("a",ch[i]);
}
else if(ch[i]=='s'|| ch[i]=='S')
{
printf("]",ch[i]);
}
else if(ch[i]=='a'|| ch[i]=='A')
{
printf("[",ch[i]);
}
else if(ch[i]==']')
{
printf("p",ch[i]);
}
else if(ch[i]=='[')
{
printf("o",ch[i]);
}
else if(ch[i]=='p'|| ch[i]=='P')
{
printf("i",ch[i]);
}
else if(ch[i]=='o'|| ch[i]=='O')
{
printf("u",ch[i]);
}
else if(ch[i]=='i'|| ch[i]=='I')
{
printf("y",ch[i]);
}
else if(ch[i]=='u'|| ch[i]=='U')
{
printf("t",ch[i]);
}
else if(ch[i]=='y'|| ch[i]=='Y')
{
printf("r",ch[i]);
}
else if(ch[i]=='t'|| ch[i]=='T')
{
printf("e",ch[i]);
}
else if(ch[i]=='r'|| ch[i]=='R')
{
printf("w",ch[i]);
}
else if(ch[i]=='e'|| ch[i]=='E')
{
printf("q",ch[i]);
}
else if(ch[i]=='w'|| ch[i]=='W')
{
printf("s",ch[i]);
}
}
printf("\n");
}
return 0;
}
#include<stdio.h>
#include<string.h>
int main()
{
int i;
char ch[1000];
while(gets(ch))
{
for(i=0; ch[i]!='\0'; i++)
{
if(ch[i]==' ')
printf(" ");
else if(ch[i]=='/')
printf(",",ch[i]);
else if(ch[i]=='.')
{
printf("m",ch[i]);
}
else if(ch[i]==',')
{
printf("n",ch[i]);
}
else if(ch[i]=='m'|| ch[i]=='M')
{
printf("b",ch[i]);
}
else if(ch[i]=='n'|| ch[i]=='N')
{
printf("v",ch[i]);
}
else if(ch[i]=='b'|| ch[i]=='B')
{
printf("c",ch[i]);
}
else if(ch[i]=='v'|| ch[i]=='V')
{
printf("x",ch[i]);
}
else if(ch[i]=='c'|| ch[i]=='C')
{
printf("z",ch[i]);
}
else if(ch[i]=='x'|| ch[i]=='X')
{
ch[i]=92;
printf("%c",ch[i]);
}
else if(ch[i]=='z'|| ch[i]=='Z')
{
printf("'",ch[i]);
}
else if(ch[i]==39)
{
printf("l",ch[i]);
}
else if(ch[i]==';')
{
printf("k",ch[i]);
}
else if(ch[i]=='l'|| ch[i]=='L')
{
printf("j",ch[i]);
}
else if(ch[i]=='k'|| ch[i]=='K')
{
printf("h",ch[i]);
}
else if(ch[i]=='j'|| ch[i]=='J')
{
printf("g",ch[i]);
}
else if(ch[i]=='h'|| ch[i]=='H')
{
printf("f",ch[i]);
}
else if(ch[i]=='g'|| ch[i]=='G')
{
printf("d",ch[i]);
}
else if(ch[i]=='f'|| ch[i]=='F')
{
printf("s",ch[i]);
}
else if(ch[i]=='d'|| ch[i]=='D')
{
printf("a",ch[i]);
}
else if(ch[i]=='s'|| ch[i]=='S')
{
printf("]",ch[i]);
}
else if(ch[i]=='a'|| ch[i]=='A')
{
printf("[",ch[i]);
}
else if(ch[i]==']')
{
printf("p",ch[i]);
}
else if(ch[i]=='[')
{
printf("o",ch[i]);
}
else if(ch[i]=='p'|| ch[i]=='P')
{
printf("i",ch[i]);
}
else if(ch[i]=='o'|| ch[i]=='O')
{
printf("u",ch[i]);
}
else if(ch[i]=='i'|| ch[i]=='I')
{
printf("y",ch[i]);
}
else if(ch[i]=='u'|| ch[i]=='U')
{
printf("t",ch[i]);
}
else if(ch[i]=='y'|| ch[i]=='Y')
{
printf("r",ch[i]);
}
else if(ch[i]=='t'|| ch[i]=='T')
{
printf("e",ch[i]);
}
else if(ch[i]=='r'|| ch[i]=='R')
{
printf("w",ch[i]);
}
else if(ch[i]=='e'|| ch[i]=='E')
{
printf("q",ch[i]);
}
else if(ch[i]=='w'|| ch[i]=='W')
{
printf("s",ch[i]);
}
}
printf("\n");
}
return 0;
}
No comments:
Post a Comment