How Many Substrings?

  • + 4 comments

    There's something wrong!

    0 2: The substrings of aab are a, b, aa, ab, and aab, so we print on a new line.

    Is this right? Is the substring (0,2) of "aabaa" really "aab".

    Shouldn't it be "aa" and not "aa b "

    There must be something wrong here...

    C++ substr takes in the start pos, and len, but the len doesn't count towards the actual string.

    In order to get "aab" you would have to get substring (0, 3).