while 1:r=range(87);s=raw_input();print max([s[i:j]for i in r for j in r if-~s.find(s[i:j],i+1)],key=len)