gets.chop! l=s.size-1 p (l.times.map{|i| eval$_[i..-1]+$_[0...i]if$_[i]=~/\d/&&$_[i-1]=~/\d/ }-[p]).max