I noticed a certain game had a peculiar life counter, which instead of stopping at 999
, gained a new digit – the next number was crown hundred or 👑00
. After 👑99
came crown hundred crownty (👑👑0
) and the last number, after 👑👑9
, was crown hundred crownty crown or 👑👑👑
, which would be 1110 in decimal.
Your task is to write a program or a function that outputs this counter.
Given an integer from the range [0,1110]
(inclusive on both ends), output a three character string where
- every character is from the list
0123456789👑
- the crown (👑) can only appear as the leftmost character or when there's a crown to the left of it
- when this number is read as a decimal number but with the crown counting as
10
, you get back the original number
Test cases
0 → "000"
15 → "015"
179 → "179"
999 → "999"
1000 → "👑00"
1097 → "👑97"
1100 → "👑👑0"
1108 → "👑👑8"
1110 → "👑👑👑"
You may use any non-decimal character instead of the crown. To encourage pretty printing, the crown character (UTF8 byte sequence "\240\159\145\145") counts as one byte instead of four. Your program doesn't have to work for numbers outside the valid range.
This is code-golf, so the shortest answer, measured in bytes, wins!