SP16389 MY02 - Play with Strings

Description

``` All you have to do is implement the following algorithm ,which is a very popular compression technique. 1.You are given an input string A. (For eg. ababc ) 2.Find all the rotations of A (In this case, it is ababc,babca,abcab,bcaba,cabab) • Now sort them (After sorting, we have ababc,abcab,babca,bcaba,cabab) • Then arrange them as follows: ababc abcab babca bcaba cabab • Now pick out the last column. It is ‘cbaab’. It is the result of this algorithm • Also observe that the 1st row has the original string.(Use 1 indexing) Now, for this problem, you are given the output and the row number that has the original string. For the above example , it is ‘cbaab’ and 1. Given these 2 parameters, you just need to decode it. (ie.,find the original string.) Input: Each test case has 2 lines. 1st line – An integer R that represents the row that contains the original string. 2nd line - A string that represents the output of the above algorithm. (Length of string

Input Format

N/A

Output Format

N/A