Task

Take a   Natural Number   in a given base and return the sum of its digits:

   110         sums to   1
   123410   sums to   10
   fe16       sums to   29
   f0e16     sums to   29


class String
  def sum_digits(base : Int) : Int32
  	self.chars.reduce(0) { |acc, c|
  		value = c.to_i(base)
  		acc += value
  	}
  end
end
 
puts("1".sum_digits 10)
puts("1234".sum_digits 10)
puts("fe".sum_digits 16)
puts("f0e".sum_digits 16)