← All problemsSign in

Reverse Words in a String

Given a string, reverse the string word by word. Here's the format of the Input. TS1S2S3... where T is the number of the strings, and S1, S2, etc. are the strings containing words to be reversed. Each input is on a new line, and can be read with subsequent input() statements in Python (or any alternative command for other languages that reads from the Standard Input or STDIN). For each String

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start