Caterpillar Interview Question

Sorting a string with best runtime