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

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

download

return top