Java Easy Solution || Beginner Friendly
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public String digitSum(String s, int k) {\n        StringBuilder sb = new StringBuilder(s);\n\n        // Continue until length of sb is less than or equal to k\n        while (sb.length() > k) {\n            StringBuilder newString = new StringBuilder();\n            int i = 0;\n\n            // Iterate over characters of sb\n            while (i < sb.length()) {\n                int sum = 0;\n                int count = 0;\n\n                // Calculate sum of digits for each group\n                while (i < sb.length() && count < k) {\n                    sum += sb.charAt(i) - \'0\';\n                    i++;\n                    count++;\n                }\n\n                newString.append(sum);\n            }\n\n            sb = newString; // Update sb with newString\n        }\n\n        return sb.toString();\n    }\n}\n\n```
['Java']