open System open System.Collections.Generic [] let main argv = let [| a; b |] = Console.ReadLine().Split(' ') let result = if a.Length <> b.Length then if a.Length > b.Length then a else b else let rec mymax (x: string) (y: string) = if x.Length = 0 then "" else let s, ss = x.[0], x.Substring(1) let t, ts = y.[0], y.Substring(1) match (s, t) with | ('4', '7') -> x | ('7', '4') -> y | _ -> if s <> t then if s > t then x else y else (string s) + mymax ss ts mymax a b printfn "%s" result //exit code 0