import java.util.Scanner object Problem293 { def keta(a: Int): Int = a.toString.length def max(a: Int, b: Int): Int = { if (keta(a) != keta(b)) { return a max b } val sa = a.toString val sb = b.toString (0 until sa.length) foreach { i => val ca = sa(i) - '0' val cb = sb(i) - '0' (ca, cb) match { case (4, 7) => return a case (7, 4) => return b case _ if ca != cb => return a max b case _ => // eq } } // 同じ a } def main(args: Array[String]) = { val sc = new Scanner(System.in) val a = sc.nextInt() val b = sc.nextInt() val result = max(a, b) println(result) } }