Issue in code Smallest KMP

Question link
https://www.codechef.com/AUG20B/problems/SKMP

My code

https://www.codechef.com/viewsolution/37014036

What is wrong i am doing here. Please someone guide me.

input
1
aaaabbbb
ba

your output
aaabbbba

expected output
aaababbb

1 Like