C++ Easy to understand (Single loop and recursive)
\nclass Solution {\npublic:\n    string digitSum(string s, int k) {\n        \n        if(s.length()<=k)\n            return s;\n        \n        string ans=""
```\nclass Solution {\npublic:\n    string digitSum(string s, int k) {\n        \n        if(s.length()<=k)\n            return s;\n        \n        string ans="";\n        int sum=0,temp=k;\n        int len = s.length();\n        for(int i=0;i<len;i++){\n            sum += (s[i] -\'0\');\n            temp--;\n            if(temp==0){\n                ans+= to_string(sum);\n                temp=k;\n                sum=0;\n            }\n        }\n        if(temp!=k){\n        ans+= to_string(sum);\n        }\n        if(ans.length()>k)\n            ans = digitSum(ans,k);\n        return ans;\n    }\n};\n```
['String', 'C']