A, B = input().split() if len(A) > len(B): print(A) exit() elif len(B) > len(A): print(B) exit() for n in range(len(A)): if A[n] == "7" and B[n] == "4": print(B) exit() elif A[n] == "4" and B[n] == "7": print(A) exit() elif int(A[n]) > int(B[n]): print(A) exit() elif int(B[n]) > int(A[n]): print(B) exit()