Firmao interview question

Sorting algorithm and String operation that and specifics fragments at begining and replacing another