def cylinder array tmp = array.shift array.push(tmp) end s = gets.chomp ans = [] a = s.split('') a.size.times{ if a[0] =~ /[^+\-]/ && a[-1] =~ /[^+\-]/ ans.push(eval(a.join(''))) end cylinder(a) } p ans.max