The problem description says: "The total length of the input file is not more than 2MB.". This would imply that there are test cases with strings several hundred thousand characters long .