getting WA in NAME2.Am I not allowed to use this library function?

can I use strstr() here? If is yes then what’s wrong in the code.

I think you misunderstood the question. The question asks you to find whether string M is a subsequence (not substring) of string W or W is subsequence of M.

And strstr() is used to find the whether one string is a substring of another string or not. Check here .

Hope this clears your doubt.

Happy Coding !!!

Thank You.