FunctionRacerProblemsRace

Sorting the Sentence

EasySorting and searchingPython, JavaScript, TypeScript, Java, C++

A shuffled sentence s has words separated by single spaces, and each word ends with a single digit from 1 to 9 giving its position in the original sentence. Return the original sentence with the digits removed and the words in position order, separated by single spaces.

Example 1

s "is2 sentence4 This1 a3"
returns "This is a sentence"

Position order gives This is a sentence.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Sorting and searching problems