def inp() a=gets.chomp.split(" ").map(&:to_i)end def copy(a) Marshal.load(Marshal.dump(a)) end def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end def scount(a,b) a.each{|n|b[n]+=1} end a,b = gets.chomp.split(" ") a = a.split("") b = b.split("") unless(a.size == b.size) if(a.size > b.size) puts a.join else puts b.join end exit end a.map!(&:to_i) b.map!(&:to_i) a.size.times do |d| if([4,7].include?(a[d]) and [4,7].include?(b[d])) if(a[d] == 4 and b[d] == 7) puts a.join exit elsif(a[d] == 7 and b[d] == 4) puts b.join exit end else if(a[d] > b[d]) puts a.join exit elsif(a[d] < b[d]) puts b.join exit end end end