Consider each value (1's,2's,3's,...) separately. Per construction, they will always be written in decreasing order. Then:
* First each value k is repeated k+1 times: 1 becomes 11, 2 becomes 222, 3 becomes 3333, etc.
* Then if a value k is appearing k+2 times or more, each block of k+2 occurences is replaced by one occurence of k+1