#K67732. Reverse the Words in Each Line
Reverse the Words in Each Line
Reverse the Words in Each Line
You are given multiple lines of text. For each line, reverse the order of the words and output the reversed line. The input terminates when a line containing only a single period ('.') is encountered. Do not process the terminating line.
Note: Words are defined as contiguous sequences of non-space characters. Each line should be processed independently.
Example:
Input: hello world this is a test .</p>Output: world hello test a is this
inputFormat
The input consists of multiple lines. Each line contains a sequence of words separated by spaces. The end of the input is indicated by a line that contains only a single period ('.'). This terminating line should not be processed.
outputFormat
For each line (except the terminating line), output a new line where the words are in reverse order, separated by a single space.
## samplehello world
.
world hello