To me, I understand as this way:
After KMP run, it returns a prefix function of each character. The physical meaning of it is that
it is the size of the longest prefix of the string that is also a suffix of the string.
For example: "abcdab". The size function for it is [0,0,0,0,1,2]. The last value tells the size of the longest prefix is 2, which is "ab".
I see that this code is accepted, then I want to ask judge to increase the limit time for C++, because I have written almost the same idea, but I am struggling for hours with time limit, and cannot pass, or if you could see some differences, I appreciated if you could mention it. Actually I believe that my code should be faster than what he did as I return back the result the moment I find the result, however, he need to traverse the whole l/2 element in the for loop, but still it does not pass the time limit