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;
	sort(s.begin(), s.end());
	int n;
	for(int i=0;i<n;i++)
	    string 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

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