C++ || Easy To Understand || Simple Brute Force Approach
\nclass Solution {\npublic:\n    int help(string &s)\n    {\n        int d=0;\n        for(int i=0;i<s.length();i++)\n        {\n            d+=(s[i]-\'0\');\n 
```\nclass Solution {\npublic:\n    int help(string &s)\n    {\n        int d=0;\n        for(int i=0;i<s.length();i++)\n        {\n            d+=(s[i]-\'0\');\n        }\n        return d;\n    }\n    string digitSum(string s, int k) {\n        int n=s.length();\n        string temp=s,neww;\n        if(k>=n)\n        return s;\n        while(temp.size()>k)\n        {\n            neww="";\n         for(int i=0;i<temp.size();i+=k)\n         {\n             string str=temp.substr(i,min((int)k,(int)(temp.size()-i)));\n             string sum=to_string(help(str));\n             neww+=sum;\n         }\n            temp=neww;\n        }\n        return neww;\n    }\n};\n```\n**Please upvote to motivate me in my quest of documenting all leetcode solutions(to help the community). HAPPY CODING:)\nAny suggestions and improvements are always welcome**
[]