Given a string s, reverse the order of words.
A word is a sequence of non-space characters. Words in the string s will have one space between them. There are no leading or trailing spaces.
s: “yoda is a jedi”
Reversed s: “jedi a is yoda”
The first line contains an integer ‘T’ denoting the number of test cases.
For each test case, the input has one line with the string ‘s’.
For each test case, the output has a line with the string ‘s’ which is reversed word-wise.
3
i am solving this problem
good evening everyone
hello
problem this solving am i
everyone evening good
hello
1 <= T <= 100
1 <= length of s <= 104
Each character of s is either a lowercase English alphabet or a space.