Cross character
Submissions: 4186   Accuracy:

19.86%

  Difficulty: Easy   Marks: 2

Convert a given string to its cross string (i.e Diagonal from left-right and from right-left). 

Input:

The first line of input contains a single integer T denoting the number of test cases. Then T test cases follow. Each test case consist of two lines. The first line of each test case consists of a String in lower case.

Output:

Print given string(in lower case) in cross manner.

Constraints:

1 ≤ T ≤ 100
1 ≤ length of string ≤ 50

Example:

Input
2
geeks
geeksforgeeks

Output
g   s e k   e   e k g   s

g           s e         k   e       e     k     e       s   g         f r           o           f r         s   g       k     e     e       e   e         k g           s

Explanation:

For the 1st test case where string is geeks

G   S
 E K
  E
 E K
G   S

The above is the proper cross manner for the test case, but when printed in a single line it becomes as shown in the output.

 

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

Author: rajatjha


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.