Java Solution - Easy to Understand
Here is my solution:\n\nclass Solution {\n    public String digitSum(String s, int k) {\n        \n        while(s.length()>k){   /*If the length of the string 
Here is my solution:\n```\nclass Solution {\n    public String digitSum(String s, int k) {\n        \n        while(s.length()>k){   /*If the length of the string is greater than k, repeat from step 1.*/\n            \n            String newstr = "";   /*for storing updated string*/\n            \n            for(int i=0; i<s.length(); i+=k){ // retrieving small parts of string in k equal parts\n\t\t\t\n                int sum=0; // for finding "sum"\n\t\t\t\t\n                String temp = s.substring(i,Math.min(i+k, s.length()));  //for substring from ith to (i+k)th position\n\t\t\t\t\n                for(int itr = 0; itr<temp.length(); itr++){\n                    sum += temp.charAt(itr) - \'0\';\n                }\n                \n                newstr = newstr + "" + sum; // storing sum into new string\n            }\n            \n            s = newstr;  /*Updating original string with new string containing sum of digits*/\n        }\n        \n        return s;\n    }\n}\n```\nIf liked the approach. Pls **upvote** :)\nFeel free to ask any doubt..\nHappy Coding !!
['Java']