#![allow(unused_imports)] #![allow(non_snake_case)] use std::collections::HashMap; use std::collections::HashSet; #[allow(unused_macros)] macro_rules! read { ([$t:ty] ; $n:expr) => ((0..$n).map(|_| read!([$t])).collect::>()); ($($t:ty),+ ; $n:expr) => ((0..$n).map(|_| read!($($t),+)).collect::>()); ([$t:ty]) => (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::>()); ($t:ty) => (rl().parse::<$t>().unwrap()); ($($t:ty),*) => {{ let buf = rl(); let mut w = buf.split_whitespace(); ($(w.next().unwrap().parse::<$t>().unwrap()),*) }}; } #[allow(dead_code)] fn rl() -> String { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); buf.trim_end().to_owned() } fn main() { let (a, b) = read!(usize, usize); let (a_str, b_str) = (a.to_string(), b.to_string()); use std::cmp::Ordering::*; match a_str.len().cmp(&b_str.len()) { Greater => { println!("{}", a); }, Less => { println!("{}", b); }, Equal => { let (a_char, b_char) = (a_str.chars(), b_str.chars()); for (ac, bc) in a_char.zip(b_char) { let ac_d = ac.to_digit(10).unwrap(); let bc_d = bc.to_digit(10).unwrap(); match (ac_d, bc_d) { (4, 7) => { println!("{}", a); return; }, (7, 4) => { println!("{}", b); return; }, (x, y) if x > y => { println!("{}", a); return; }, (x, y) if x < y => { println!("{}", b); return; } _ => { continue; } } } } } }