def checker(A, B): for i in xrange(len(A)): if int(A[i]) > int(B[i]): if int(A[i]) == 7 and int(B[i]) == 4: print B return else: print A return elif int(A[i]) < int(B[i]): if int(A[i]) == 4 and int(B[i]) == 7: print A return else: print B return print A A,B = raw_input().split() if len(A) > len(B): print A elif len(A) < len(B): print B else: checker(A,B)