Roll the characters of a String
Submissions: 4394   Accuracy:

20.4%

  Difficulty: Easy   Marks: 2

We are given a string s and an array roll where roll[i] represents rolling first roll[i] characters in string. We need to apply every roll[i] on string and output final string. Rolling means increasing ASCII value of character, like rolling ‘z’ would result in ‘a’, rolling ‘b’ would result in ‘c’, etc.

Input : s = "bca"
        roll[] = {1, 2, 3}         
Output : eeb

Explanation :
arr[0] = 1 means roll first character of string -> cca
arr[1] = 2 means roll first two characters of string -> dda
arr[2] = 3 means roll first three characters of string -> eeb
So final ans is "eeb"

Input:
First line consist of T test cases. First line of every test case consists of N. Second and third line consists of String and Array of N size, respectively.

Output:
Single line output, print the modified String.

Constraints:
1<=T<=100
1<=N<=1000

Example:
Input:

1
3
bca
1 2 3
Output:
eeb

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth


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.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.