Getting a runtime error(SIGABRT) - MEXSTR

Hey community
I tried this question using this code. It’s a naive solution. But, I got a SIGABRT error.
Can anyone please help me why,where it occurred and how to rectify the same.
subs is for checking if a string(b) is a subsequence of the other(a)
bin is for converting to binary

Thanks in advance