Python beats 100% memory 85% space | With Comments
\nclass Solution:\n    def digitSum(self, s: str, k: int) -> str:\n        \n        # Requirement 3; Merge groups when string s > k\n        while len(s) > k:\
```\nclass Solution:\n    def digitSum(self, s: str, k: int) -> str:\n        \n        # Requirement 3; Merge groups when string s > k\n        while len(s) > k:\n            temp = "" # Will contain the next round\'s string s\n            i = 0 # counter to exit while loop below, when out of groups\n            \n            # Requirement 1; divide string s into groups of size k\n            while i < len(s): \n                groupVal = 0  # Will contain sum of current group\'s digits\n                \n                # Requirement 3; Merge group into sum of all digits\n                for c in s[i:i+k]:  # Take each character of the current group and add to sum of digits\n                    groupVal += int(c) \n                temp += str(groupVal) # cast sum to string and append to next round\'s string s\n                i += k\n            s = temp \n        return s\n```\nHope this makes sense! Feel free to provide suggestions
['String', 'Python']