selveral priority to choose which char to represent corresponding english number:
- unique among all english numbers.
-
less freqency in other words if not unique Also, note ```python class Solution: def originalDigits(self, s: str) -> str: “”” zero z one o 1-0-2-4 two w three h 3-8 four u five v 5-7 six x seven s 7-6 eight g nine i 9-8-6-5
""" # step1 create a array as map index as key, value as freq cnt = [0] * 10 # step2 count each unique char's freq counter = collections.Counter(s) # step3 first even then odd cnt[0] = counter['z'] cnt[2] = counter['w'] cnt[4] = counter['u'] cnt[6] = counter['x'] cnt[8] = counter['g'] # step4 process odd numbser cnt[3] = counter['h'] - cnt[8] cnt[7] = counter['s'] - cnt[6] cnt[5] = counter['v'] - cnt[7] cnt[1] = counter['o'] - cnt[0] - cnt[2] -cnt[4] cnt[9] = counter['i'] - cnt[5] - cnt[6] -cnt[8] # step5, join string together res = [] for num in range(len(cnt)): if cnt[num] != 0: res.append(str(num)* cnt[num]) return ''.join(res)
```