Python simple solution both recursive and iterative
Recursive:\n\nclass Solution:\n    def digitSum(self, s: str, k: int) -> str:\n        def str_sum(s):\n            return str(sum([int(i) for i in s]))\n\n    
***Recursive:***\n```\nclass Solution:\n    def digitSum(self, s: str, k: int) -> str:\n        def str_sum(s):\n            return str(sum([int(i) for i in s]))\n\n        if len(s) <= k:\n            return s\n        tmp = []\n        for i in range(0, len(s), k):\n            tmp.append(str_sum(s[i:i + k]))\n        s = \'\'.join(tmp)\n        return self.digitSum(s, k)\n```\n\n***Iterative:***\n```\nclass Solution:\n    def digitSum(self, s: str, k: int) -> str:\n        def str_sum(s):\n            return str(sum([int(i) for i in s]))\n\n        while len(s) > k:\n            tmp = []\n            for i in range(0, len(s), k):\n                tmp.append(str_sum(s[i:i + k]))\n            s = \'\'.join(tmp)\n        return s\n```
['Recursion', 'Iterator', 'Python', 'Python3']