Not sure where to post this.
In the Problem, it is stated:
He makes a string M of length N, such that after deleting a substring of non-zero length from M, the remaining string is S
And yet, i kept failing the tests until i checked the corner case of a zero-length substring.
I think it causes confusion and frustration to many.