← back to unit
Medium
# stacks medium
Flip Every Word
The prankster spell reverses each word but leaves the sentence order alone. ✨
You get a sentence of space-separated words. Reverse each word (stack of letters!) but keep the words in order. Print the result.
Example:
Input: sentence = "hello brave world"
Output: olleh evarb dlrow
Each word gets reversed on its own (hello → olleh, brave → evarb, world → dlrow) while the word order stays the same.
💡 need a hint?
stk-flip-every-word.py🔒 given lines are locked — write your code in between
loading...