✅✅C++ || Easy Solution || 0ms || Faster
\'\'\'\nclass Solution {\npublic:\n\n    string digitSum(string s, int k) {\n        string ans;\n        while(1){\n            \n            if(s.length()<=k)
\'\'\'\nclass Solution {\npublic:\n\n    string digitSum(string s, int k) {\n        string ans;\n        while(1){\n            \n            if(s.length()<=k)   return s;\n            \n            int sum=0;\n            for(int i=0;i<s.size();i++){\n                if(i!=0 and i%k==0){\n                    ans+=to_string(sum);\n                    sum=0;\n                }\n                sum+=(s[i]-\'0\');\n            }//end of for\n            \n            ans+=to_string(sum);\n            s=ans;\n            ans="";\n            \n        }//end of while\n    }\n};\n\n\'\'\'\n\nPlease Upvote if you like the Solution.\n\uD83D\uDE42
['String', 'C']