Java | Simple
```\npublic String digitSum(String s, int k) {\n        StringBuilder sb = new StringBuilder(s);\n        while (sb.length()>k) {\n            int idx = 0;\n   
```\npublic String digitSum(String s, int k) {\n        StringBuilder sb = new StringBuilder(s);\n        while (sb.length()>k) {\n            int idx = 0;\n            StringBuilder curr = new StringBuilder();\n            while (idx<sb.length()) {\n                String ss = sb.toString().substring(idx, Math.min(idx+k,sb.length()));\n                idx+=k;\n                int value = 0;\n                for (char c: ss.toCharArray()) {\n                    value = value + (c-\'0\');\n                }\n                curr.append(value);\n            }\n            sb = new StringBuilder(curr);\n        }\n        \n        return sb.toString();\n    }
[]