Correct solution for interleaved strings