def main(): A, B = input().split() if len(A) > len(B): print(A) return if len(B) > len(A): print(B) return for a_elm, b_elm in zip(A, B): match a_elm: case "4": match b_elm: case "7": print(A) return case "4": continue case num: if 4 > int(num): print(A) else: print(B) return case "7": match b_elm: case "4": print(B) return case "7": continue case num: if 7 > int(num): print(A) else: print(B) return case num: if int(num) < int(b_elm): print(B) return if int(num) > int(b_elm): print(A) return if __name__ == "__main__": main()