using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; string[] inpt = Reader.ReadLine().Split(' '); string num1 = inpt[0].TrimStart(new char[] { '0' }); string num2 = inpt[1].TrimStart(new char[] { '0' }); if (num1.Length == 0) { num1 = "0"; } if (num2.Length == 0) { num2 = "0"; } string ans = num1; if (num1.Length > num2.Length) { ans = num1; } else if (num2.Length > num1.Length) { ans = num2; } else { for (int i = 0; i < num1.Length; i++) { if (num1[i] == '7' && num2[i] == '4') { ans = num2; break; } else if (num1[i] == '4' && num2[i] == '7') { ans = num1; break; } else if (num1[i] > num2[i]) { ans = num1; break; } else if (num1[i] < num2[i]) { ans = num2; break; } } } Console.WriteLine(ans); } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 1237564890 1234567890 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }