You are given a string and a number of queries to perform. For each query you have to rotate the string either left or right. For example, if the string is abcde, rotating left by 1 character will give bcdea. Now rotating again right by 1 character will give abcde back.
Find the resultant string after performing all the queries.
Input Fomat
Output Format
Constraints
Author: Ankit Saini
The input string is abcde
After the first query: bcdea
After the second query: cdeab
After the third query: bcdea