Help me in solving ALPHABET problem

My issue

My code

#include <iostream>
#include <set>
#include <algorithm>
using namespace std;

int main() {
	// your code goes here
	string s;
	cin>>s;
	sort(s.begin(), s.end());
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
	    string str;
	    cin>>str;
	    sort(str.begin(), str.end());
	    if(includes(str.begin(),str.end(), s.begin() , s.end()))
	    
	    
	    std::cout << "Yes" << std::endl;
	    else std::cout << "No" << std::endl;
	}
	return 0;
}

Problem Link: ALPHABET Problem - CodeChef

@pranto1610
your logic is not right
like for s to be β€œcat” and word to be β€œct” your code will give No but it would be yes

1 Like