# 入力された値を文字列で受け取る input = gets.chomp a = input.split("") sum = 0 a.each do |int| b = int.to_i sum += b end puts sum