Ruby Solution. Easy to understand
\n# @param {String} s\n# @param {Integer} k\n# @return {String}\ndef digit_sum(s, k)\n    while s.size > k\n        arr = []\n        i = 0\n        while i < s
```\n# @param {String} s\n# @param {Integer} k\n# @return {String}\ndef digit_sum(s, k)\n    while s.size > k\n        arr = []\n        i = 0\n        while i < s.size\n            sum = 0\n            s[i...(i + k)].each_char { |c| sum += c.to_i }\n            arr.push(sum.to_s)\n            i += k\n        end\n        s.replace(arr.join)\n    end\n    \n    s\nend\n```
['Ruby']