Given an odd length word your task is to complete the function printPattern that takes a string s as its argument and prints it from the middle of the word such that it follows the following pattern.
Input: PROGRAM Input: RAT Output: Output: G A GR AT GRA ATR GRAM GRAMP GRAMPR GRAMPRO The above is proper shaped pattern for the test case, but when printed in a single line it becomes as shown in the output.
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of a single line containing an odd length string s.
Corresponding to each test case in a new line print the pattern in a single line where each row of the pattern is separated by a "$" instead of a new line.
1 ≤ T ≤ 20
1<=size of string(s)<=20
Example(To be used only for expected ouput):
G$ GR$ GRA$ GRAM$ GRAMP$ GRAMPR$GRAMPRO$ A$ AT$ATR$
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.