Codewars: Rust workspace for solving the 'Your Order Please' kata
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
541 B

3 years ago
  1. ## Your Order, Please
  2. Your task is to sort a given string. Each word in the string will contain a single number. This number is the position the word should have in the result.
  3. >*Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).*
  4. If the input string is empty, return an empty string. The words in the input String will only contain valid consecutive numbers.
  5. **Examples**
  6. ```
  7. "is2 Thi1s T4est 3a" --> "Thi1s is2 3a T4est"
  8. "4of Fo1r pe6ople g3ood th5e the2" --> "Fo1r the2 g3ood 4of th5e pe6ople"
  9. "" --> ""
  10. ```