Convert a given string to its cross string (i.e Diagonal from left-right and from right-left).
See examples for better understanding.
Input:abcOutput:a c b a cExplanation:The above is the proper
cross manner for the
test case.a c b a c
Input:geeksOutput:g s e k e e k g sExplanation:For the 1st test case where the string is geeks
G SThe above is the proper cross the manner for the test case, but when printed in a single line it becomes as shown in the output.
You don't need to read input or print anything. Your task is to complete the function crossPattern() which takes the string S and returns a single string in the following way first-line output of the string concatenated with 2nd line and so on till the Nth line.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)