What is the last testcase of this task? I always have "Invalid memory reference (memory limit exceeded"..... :(
agenti
the task description is kinda wrong, i got AC after i changed the string size to a million... ( higher constraints are obvious as the optimal solution too fast to limit it to 3K and something ) it would be nice if the admin changed the constraints to their actual value.