TASHIFT Error

python27
string

#1

I am using python. I don’t think there is anything wrong with my algorithm. I am using z-algorithm to compute the values of longest prefixes of the string as A+B+B.(+means concatenation).
I am new to python and it is my second question with this language.Can anybody please tell what error i am making??
Thanx in advance.
MY submission id link is:http://www.codechef.com/viewsolution/6650000