a = gets.chomp if /[0-90-9]/ === a b = a.delete("^0-9") c = b.split("") c = c.map(&:to_i) sum = c.inject(:+) puts sum else puts "0" end