Not everyone probably knows that Nivin has younder brother Nithin. Currently Nithin learns to read.He knows some subset of the letter of Latin alphabet. In order to help Nithin to study, Nivin gave him a book with the text consisting of N words. Nithin can read a word iff it consists only of the letters he knows.Now Nivin is curious about which words his brother will be able to read, and which are not. Please help him!
#include <stdio.h>
#include <string.h>
int main()
{
char string[100];char search[100];
int t,i,j,len,c=0;
scanf("%s",string);
len=strlen(string);
scanf("%d",&t);
while(t- -){
c=0;
scanf("%s",search);
for(i=0;i<=strlen(string)-1;i++)
{
for(j=0;j<=strlen(search)-1;j++)
{
if(string[i]==search[j]){
c++;break;}
}
}
if(c==len)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}
Comments
Post a Comment