Problem Type : Simple Ad hoc
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#define max 100
int main()
{
char ch[max],des[max];
int i,j,k,len1,len2,test,cou;
scanf("%d",&test);
getchar();
while(test--)
{
scanf("%s %s",ch,des);
len1=strlen(ch);
len2=strlen(des);
if(len1!=len2)
{
printf("No\n");
}
else
{
cou=0;
for(i=0; i<len1; i++)
{
if((ch[i]=='a' ||ch[i]=='e'|| ch[i]=='i' ||ch[i]=='o' ||ch[i]=='u') && (des[i]=='a'||des[i]=='e'||des[i]=='i'||des[i]=='o'||des[i]=='u'))
{
cou++;
continue;
}
else
{
if(ch[i]==des[i])
{
cou++;
}
else
{
break;
}
}
}
if(cou==len1)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
memset(ch,'\0',sizeof(ch));
memset(des,'\0',sizeof(des));
}
return 0;
}
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#define max 100
int main()
{
char ch[max],des[max];
int i,j,k,len1,len2,test,cou;
scanf("%d",&test);
getchar();
while(test--)
{
scanf("%s %s",ch,des);
len1=strlen(ch);
len2=strlen(des);
if(len1!=len2)
{
printf("No\n");
}
else
{
cou=0;
for(i=0; i<len1; i++)
{
if((ch[i]=='a' ||ch[i]=='e'|| ch[i]=='i' ||ch[i]=='o' ||ch[i]=='u') && (des[i]=='a'||des[i]=='e'||des[i]=='i'||des[i]=='o'||des[i]=='u'))
{
cou++;
continue;
}
else
{
if(ch[i]==des[i])
{
cou++;
}
else
{
break;
}
}
}
if(cou==len1)
{
printf("Yes\n");
}
else
{
printf("No\n");
}
}
memset(ch,'\0',sizeof(ch));
memset(des,'\0',sizeof(des));
}
return 0;
}
No comments:
Post a Comment