C++ Alternate words in reverse order.
Submissions: 858   Accuracy:

24.89%

  Difficulty: Easy   Marks: 2

Given a string s, display the alternate words in the reverse order.

Input: 
The first line of input contains integer T denoting the number of test cases. For each test case, we input a string s.

Output: 
For each test case, the output is a string displaying the words at even position in reverse order.

Constraints:
1<=T<=100

Example:
Input:
2
Geeks for geeks
hey        geek

Output:
Geeks rof geeks
hey keeg

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Vanshika
Author: Vanshika_pec


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.