05AB1E, 4 bytes
3Fgì
Similar as my answer for the related challenge, but with a prepend instead of append. Will therefore also use base-10, and always use the smallest (9
instead of 10
) if more than one option is available.
Try it online or verify all test cases.
Explanation:
3F # Loop 3 times:
g # Pop the current string, and push its length
# (which will use the implicit input-string in the first iteration)
«ì # Prepend this length to the (implicit) input-string
# (after which the result is output implicitly)