a = gets.chomp; b = a.chars.reverse.each_with_index; $I = 0; c = b.map {|c, i| c == ?0 ? ($I = i + 1) : $I }; d = c.sum puts d