digits and a number size. While the string is longer than size, run a round:
1. Split the string from left to right into groups of size characters (the last group may be shorter).
2. Replace each group with the sum of its digits, written in decimal. For example, the group "479" becomes "20".
3. Join the results in order; that is the new string.
Return the string you are left with once no more rounds apply.digits="5823917", size=3 → '710'
Round 1: "582", "391", "7" → 15, 13, 7 → "15137". Round 2: "151", "37" → 7, 10 → "710". Its length 3 does not exceed size, so we stop.
digits="4096", size=4 → '4096'
The string is already no longer than size, so no rounds happen.
digits="000000", size=2 → '00'
digits contains only digitsdigits="5823917", size=3
'710'
Run checks the first 3 tests in your browser. Submit checks all 107 tests on the server, hidden ones included.