gets $I = 0 puts gets.split.reverse.each_with_index.map {|c, i| c == ?0 ? ($I = i + 1) : $I }.sum