53. Reverse the words

EasyProgramFree10 points

Write reverseWords s: the words of s in reverse order, separated by single spaces. Words are separated by one or more spaces, and s may start or end with spaces, which do not appear in the result.

Examples

  1. InputreverseWords "the sky is blue"Output"blue is sky the"
  2. InputreverseWords " hello world "Output"world hello"

Submitting also runs 5 hidden tests.

Solution.lean
Loading editor…

Run checks your code against the examples and your custom inputs and records nothing. Submit also runs the hidden tests, confirms the axioms your proof uses and records the result. Each uses one compiler check.

ReadyLn 1, Col 1Lean 4
Draft saved in this browser