Something bizzare happing it costed me during contest
i’m considering only first subtask
in 1 subtask task no. 4,5 giving TLE in first code(using function to find matching prefix)
while it passes using second code(inline code of same fucntion);
code 1: