s = gets.chomp.split("") res = 0 numbers = (1..9).to_a.map(&:to_s) s.each do |i| if numbers.include?(i) then res += i.to_i end end puts res