The first line of the input contains ‘T’ denoting the number of test cases. The first line of each test case contains a string ‘S’.
For every test case, we need to print the reversed string in a new line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 10 0 <= |S| <= 5000 Where |S| denotes the length of string 'S'. Time Limit: 1 Sec
Approach: Just like in order to reverse a string ‘S’ = “abcd”, we can can swap(S, S) and swap(S,S) to get new string “dcba”.
Similarly in this problem, we do the same using two pointers while ignoring the non-letter characters.
Eg: S = “a-bcd” we swap(S, S) and swap(S, S) to get the result.