• + 9 comments

    Just remember that there will be two conditions to check. (Look out for abc and abcde in below test cases):

    1. The prefix string comes before the longer string.

      • 7
      • aab
      • defgab
      • abc
      • abcde
      • cedaaa
      • bbbbbbbbbb
      • jabjjjad
    2. Prefix string will come after the longer string.

      • 7
      • aab
      • defgab
      • abcde
      • abc
      • cedaaa
      • bbbbbbbbbb
      • jabjjjad

    Make sure that you get correct output for both the cases, and you may trust that other things will fall in place.