Easy and Faster than 100% solution in cpp
class Solution {\npublic:\n    string digitSum(string s, int k) {\n\t\n        while(s.size()>k){\n        string res="";\n        for(int i=0;i<s.size();){\n  
class Solution {\npublic:\n    string digitSum(string s, int k) {\n\t\n        while(s.size()>k){\n        string res="";\n        for(int i=0;i<s.size();){\n            int sum=0,j=i;\n            for(;j<i+k and j<s.size();j++) sum+= (s[j]-\'0\');\n            res+= to_string(sum);\n            i=j;\n        }\n        s=res;\n    }\n    return s;\n    }\n};
[]