Name sort
Statement
Goal
You are given a string s of digits from 1 to 9 (with possibly duplicates). Sort the digits by their english name.Examples:
123 --> 132 (since alphabetically "one" < "three" < "two")
75 --> 57 (since "five" < "seven")
3351 --> 5133
73117 --> 11773
Since it's a shortest only, you are also given the following table, although you don't necessarily have to use it:
1 one
2 two
3 three
4 four
5 five
6 six
7 seven
8 eight
9 nine
Input
Line 1 : A string s of digits.
Output
A string of digits sorted by the stated rules.
Constraints
0 < length s <= 100
Example
Input
123
Output
132
Game modes
Shortest
Test cases
Example Test
Input
123
Output
132
Validator 1 Validator
Input
3214
Output
4132
Duplicates Test
Input
11233
Output
11332
Validator 2 Validator
Input
33444
Output
44433
Medium Test
Input
1234111246677
Output
4411117766322
Validator 3 Validator
Input
789913799197
Output
899999117773
All numbers Test
Input
987654321
Output
854917632
Validator 4 Validator
Input
123456789
Output
854917632
Random l=50 Test
Input
74558236843135423138989571983421388922557613422896
Output
88888888555555444449999911111777666333333332222222
Validator 5 Validator
Input
22688773677911594899467871565711749555764498136153
Output
88888555555544444999999111111177777777766666633322
Random l=100 Test
Input
7918189236372528468545975748454121919657164897543218195857887985548123655472251667413573211737414494
Output
8888888888885555555555555554444444444444499999999911111111111111777777777777766666663333333222222222
Validator 6 Validator
Input
9474143347369992572386546895582119188817126848723391866956797848956963558787317269741458156692854775
Output
8888888888888885555555555554444444444999999999999911111111117777777777777666666666666333333332222222
Solution language
Solution
Stub generator input