while 1:s=raw_input();r=range(99);print max([s[i:j]*(s[i:j]in s[i+1:])for i in r for j in r],key=len)

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top