i=w=input() S=s=" " while 1:s=s[i+1:]or raw_input()+S;i=s.rindex(S,0,w);print s[:i]
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page