Help me in solving ALPHABET problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	string s;
	cin>>s;
	int n;
	cin>>n;
	while(n--)
	{
	    string k;
	    cin>>k;
	    int i,j;
	    int a=s.length();
	    int b=k.length();
	   
	    int count=0;
	   for(i=0;i<a;i++)
	   {
	        for(j=0;j<b;j++){
	        if (s[j]==k[i])
	        {
	           count++;
	           
	           }
	        }
	   }
	  
	   if (count==b)
	   {
	       cout<<"YES"<<endl;
	   }
	  else
	   {
	     	       cout<<"NO"<<endl;  
	   }
	}
	return 0;
}

Problem Link: ALPHABET Problem - CodeChef

1 Like

@kjha1893
have corrected your code just two little mistakes.
u will get it after seeing the code.

include
using namespace std;

int main() {
// your code goes here
string s;
cin>>s;
int n;
cin>>n;
while(nā€“)
{
string k;
cin>>k;
int i,j;
int a=s.length();
int b=k.length();

    int count=0;
   for(i=0;i<b;i++)
   {
        for(j=0;j<a;j++){
        if (s[j]==k[i])
        {
           count++;
           break;
           
           }
        }
   }
  
   if (count==b)
   {
       cout<<"Yes"<<endl;
   }
  else
   {
     	       cout<<"No"<<endl;  
   }
}
return 0;

}

thank you Dost