String Reversal
Submissions: 1561   Accuracy:

23.54%

  Difficulty: Basic   Marks: 1

Given a string, say S, print it in reverse manner eliminating the repeated characters and spaces.

Input:
The first line contains T denoting the number of testcases. T testcases follow. Each case contains a string containing spaces and characters.

Output:
For each test case, output a single line containing the reversed String with repeated characters eliminated.

Constraints:
1 <= T <= 100
1 <= Length of String <= 100000

Example:
Input:
2
GEEKS FOR GEEKS
I AM AWESOME

Output:
SKEGROF
EMOSWAI

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

Contributor: Amit Khandelwal
Author: Amit Khandelwal 1


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.