using System; using System.Collections.Generic; using System.Linq; class Program { static int ReadInt() { return int.Parse(Console.ReadLine()); } static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); } static string[] ReadStrings() { return Console.ReadLine().Split(); } static void Calc(string a, string b) { if (a.Length == b.Length) { for (int i = 0; i < a.Length; i++) { int x = a[i] - '0'; int y = b[i] - '0'; if (x == 4 && y == 7) { Console.WriteLine(a); return; } else if (x == 7 && y == 4) { Console.WriteLine(b); return; } else if (x != y) { Console.WriteLine(x < y ? b : a); return; } } // a == b Console.WriteLine(a); } else { var x = new[] { a, b }.OrderBy(e => e.Length).Last(); Console.WriteLine(x); } } static void Main() { var ab = ReadStrings(); Calc(ab[0], ab[1]); } }