C++|| solution
\nclass Solution {\npublic:\n    string digitSum(string s, int k) {\n        \n        \n        \n        while(s.size()>k)\n        {\n            string res=
```\nclass Solution {\npublic:\n    string digitSum(string s, int k) {\n        \n        \n        \n        while(s.size()>k)\n        {\n            string res="";\n        int n=s.size();\n        int i=0;\n        while(i<n)\n        {\n            int c=0;\n            string temp="";\n            int count=0;\n            while(i<n && c<k)\n            {\n                count+=s[i]-\'0\';\n                c++;\n                i++;\n            }\n            string str=to_string(count);\n            res+=str;\n        }\n            \n        s=res;\n        }\n        return s;\n    }\n};\n```
[]