Simple Ruby solution with full explanation
\ndef digit_sum(s, k)\n  # so we will loop until string size is greater than k\n  while s.size > k\n    # blank string to store up the value\n    z = \'\'\n    
```\ndef digit_sum(s, k)\n  # so we will loop until string size is greater than k\n  while s.size > k\n    # blank string to store up the value\n    z = \'\'\n    # we will slice upto k elements and pass it to the loop\n    s.chars.each_slice(k) do |a|\n      # we will sum up, turn it into a string and add with the z\n      z += a.sum(&:to_i).to_s\n    end\n    # we will pass z to s thus it will loop again\n    s = z\n  end\n  # return s when it is not greater than k\n  s\nend\n```
['Ruby']