You have a String of length N consisting of lowercase English letters. You have to encrypt the string using a sophisticated algorithm as follows:
1. There are Q passes.
2.In each pass, an index i is arbitrarily chosen and another index j (not necessarily different), is determined by the following pseudo-code which runs for t iterations where initially j=i :
k=j
j=(a∗j+b)%N
b=k
3. The characters at index i and j are swapped at the end of each pass.
Find the encrypted string after Q passes.
Note: Large Input! Use Fast I/O.
Print a single line containing the encrypted String.
At the end of 1st iteration j=(1∗4+2)%7=6,b=4
At the end of 2nd iteration j=(1∗6+4)%7=3,b=6
At the end of 3rd iteration j=(1∗3+6)%7=2,b=3
Hence, s[4] is swapped with s[2], changing sptraan to spartan .