a="" while 1:a=max(map(raw_input(a).rjust,range(199)),key=lambda c:sum(x==y for x,y in zip(a,c)))+"\n"