Fix computation of start and end of each partition of the string.
This is to fix IndexOutOfBoundsException when length of input is
divisible by maxCookieSize.