Help with a string matching problem

Hello,

I was solving a question on substring matching ( problem code: SUBMATCH).

The following is the link to my solution:
https://www.codechef.com/viewsolution/30882133

The code compiles and gives the expected output correctly for all the test cases I use. However,I get a SIGABRT error while submitting the code. Can anyone help me with this issue?

Thanks.

Change your comparestr function to this

bool comparestr(const string& s1,const string& s2)
{   if(s1.length()!=s2.length())
    return(s1.length()<s2.length());
}

It gets WA though.

SIGABRT errors are caused by your program aborting due to a fatal error. In C++, this is normally due to an assert statement in C++ not returning true, but some STL elements can generate this if they try to store too much memory.

Thanks a lot bro. This helped me a lot