79543558

Date: 2025-03-29 16:41:49
Score: 1.5
Natty:
Report link

Sorting by index in the desired order:

def sort_string(s): 
    return ''.join(sorted(s, key='23456789TJQKA'.index))

print(sort_string('Q4JTK') == '4TJQK')
print(sort_string('9T43A') == '349TA')
print(sort_string('T523Q') == '235TQ')

Attempt This Online!

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Robert