class Yukicoder def initialize s = gets.chomp list = s.chars max_val = 0 0.upto(s.size-1) do |n| begin a = list.rotate(n).join if a =~ /^\d.*\d$/ val = eval(a) max_val = [max_val, val].max end rescue => ex end end puts max_val end end Yukicoder.new