Given a string S and an array roll where roll[i] represents rolling first roll[i] characters in the string, the task is to apply every roll[i] on the string and output the final string. Rolling means increasing the ASCII value of character, like rolling z would result in a, rolling b would result in c, etc.
 
Example 1:
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".
 
Example 2:
Input: s = "zcza"
roll[] = {1, 1, 3, 4}
Output: debb
 
Your Task:
This is a function problem. You don't need to take any input, as it is already accomplished by the driver code. You just need to complete the function findRollOut() that takes String S, array roll, and integer N as parameters and returns the modified string.
Note- The length of the array roll and length of the string are equal.
 
Expected Time Complexity: O(N). 
Expected Auxiliary Space: O(N).
 
Constraints:
1 ≤ N ≤ 10^{7}

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).

Starter code:
class Solution:

    def findRollOut(self, s, roll, n):

        # Your code goes here

Solutions:
class Solution:

	def findRollOut(self, s, roll, n):
		freq = [0] * (n + 2)
		(p, freq, res) = ([], [0] * (n + 2), '')
		roll.sort()
		for index in range(n):
			freq[roll[index]] += 1
		for index in range(n, -1, -1):
			freq[index] += freq[index + 1]
			freq[index] %= 26
		for index in range(n):
			final_val = ord(s[index]) + freq[index + 1]
			final_val = final_val if 97 <= final_val <= 122 else final_val - 26
			res += chr(final_val)
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		freq = [0] * (n + 2)
		for i in range(n):
			freq[roll[i]] += 1
		for i in range(n, -1, -1):
			freq[i] += freq[i + 1]
		for i in range(1, n + 1):
			s = s[:i - 1] + chr((ord(s[i - 1]) - ord('a') + freq[i]) % 26 + ord('a')) + s[i:]
		return s


class Solution:

	def findRollOut(self, s, roll, n):
		arr = [0] * (n + 1)
		res = list(s)
		for i in roll:
			arr[0] += 1
			arr[i] -= 1
		for i in range(n):
			if i != 0:
				arr[i] += arr[i - 1]
			temp = ord(s[i]) - ord('a')
			temp = (temp + arr[i]) % 26 + 97
			res[i] = chr(temp)
		return ''.join(res)


from collections import defaultdict

class Solution:

	def findRollOut(self, s, roll, n):
		rolls = [0] * n
		store = defaultdict(lambda : 0)
		for item in roll:
			store[item - 1] += 1
		count = 0
		for i in range(n - 1, -1, -1):
			count += store[i]
			rolls[i] += count
		output = ''
		for i in range(n):
			value = (ord(s[i]) + rolls[i] - 97) % 26 + 97
			output += chr(value)
		return output


class Solution:

	def findRollOut(self, s, roll, n):
		res = ''
		temp = [0] * len(roll)
		for i in roll:
			temp[i - 1] += 1
		for i in range(len(temp) - 2, -1, -1):
			temp[i] += temp[i + 1]
		for i in range(len(temp)):
			if ord(s[i]) + temp[i] % 26 > ord('z'):
				res += chr(ord(s[i]) + temp[i] % 26 - 26)
			else:
				res += chr(ord(s[i]) + temp[i] % 26)
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		s_roll = [0] * (len(s) + 1)
		for i in roll:
			s_roll[0] += 1
			s_roll[i] -= 1
		total = s_roll[0]
		for j in range(1, len(s_roll)):
			total += s_roll[j]
			s_roll[j] = total
		res = []
		for k in range(len(s_roll) - 1):
			res.append(chr((ord(s[k]) - 97 + s_roll[k]) % 26 + 97))
		return ''.join(res)


class Solution:

	def findRollOut(self, s, roll, n):
		m = max(roll)
		m = max(m, len(s))
		arr = [0] * m
		for i in roll:
			arr[i - 1] += 1
		for i in range(m - 2, -1, -1):
			arr[i] += arr[i + 1]
		t = ''
		for i in range(len(s)):
			d = (ord(s[i]) - 97 + arr[i]) % 26
			t += chr(97 + d)
		return t


class Solution:

	def findRollOut(self, s, roll, n):
		a = [0] * (n + 1)
		a[0] = n
		for r in roll:
			a[r] -= 1
		for i in range(1, len(a)):
			a[i] += a[i - 1]
		result = ''
		for i in range(len(s)):
			result += chr(ord('a') + (ord(s[i]) - ord('a') + a[i]) % 26)
		return result


class Solution:

	def findRollOut(self, s, roll, n):
		chars = list(s)
		n = len(chars)
		shifts = [0] * (n + 1)
		for r in roll:
			shifts[0] += 1
			shifts[r] -= 1
		for i in range(1, n):
			shifts[i] += shifts[i - 1]
		for i in range(n):
			chars[i] = chr((ord(chars[i]) - 97 + shifts[i]) % 26 + 97)
		return ''.join(chars)


class Solution:

	def findRollOut(self, s, roll, n):
		increments = [0] * n
		for r in roll:
			increments[r - 1] += 1
		res = ''
		curr = 0
		for i in range(n - 1, -1, -1):
			curr += increments[i]
			res = chr((ord(s[i]) - ord('a') + curr) % 26 + ord('a')) + res
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		roll.sort()
		res = ''
		r_pointer = n - 1
		curr = 0
		for s_pointer in range(n - 1, -1, -1):
			while roll[r_pointer] > s_pointer and r_pointer >= 0:
				curr += 1
				r_pointer -= 1
			res = chr((ord(s[s_pointer]) - ord('a') + curr) % 26 + ord('a')) + res
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		char_list = list(s)
		length = len(s)
		total_rolls = [0] * length
		total_sum = 0
		for r in roll:
			total_rolls[r - 1] += 1
		for i in range(length - 1, -1, -1):
			total_sum += total_rolls[i]
			char_list[i] = self.rollChar(char_list[i], total_sum)
		return ''.join(char_list)

	def rollChar(self, s, roll):
		a = 97
		char_value = ord(s) - a
		return chr(a + (char_value + roll) % 26)


class Solution:

	def findRollOut(self, s, roll, n):
		char_list = list(s)
		length = len(s)
		total_sum = 0
		total_rolls = [0] * length
		for r in roll:
			total_rolls[r - 1] += 1
		for i in range(length - 1, -1, -1):
			total_sum += total_rolls[i]
			char_list[i] = self.calculateChar(char_list[i], total_sum)
		return ''.join(char_list)

	def calculateChar(self, char, roll):
		a = 97
		calculated_char = ord(char) - a
		return chr(a + (calculated_char + roll) % 26)


class Solution:

	def findRollOut(self, s, roll, n):
		res = list(s)
		num_rolls = [0] * len(s)
		for r in roll:
			num_rolls[r - 1] += 1
		cur_sum = 0
		for i in range(len(num_rolls) - 1, -1, -1):
			cur_sum += num_rolls[i]
			res[i] = self.roll_char(res[i], cur_sum)
		return ''.join(res)

	def roll_char(self, char, r):
		a = ord('a')
		c = ord(char) - a
		return chr(a + (c + r) % 26)


class Solution:

	def findRollOut(self, s, roll, n):
		li = [0] * (n + 1)
		for i in roll:
			li[i] += 1
		string = ''
		for i in range(n):
			num = (ord(s[n - i - 1]) + li[n - i] - 97) % 26
			string = chr(num + 97) + string
			li[n - i - 1] += li[n - i]
		return string


class Solution:

	def findRollOut(self, s, roll, n):
		s = list(s)
		shift = [0] * len(roll)
		ans = ''
		for i in roll:
			shift[i - 1] += 1
		for i in range(len(shift) - 2, -1, -1):
			shift[i] += shift[i + 1]
		for i in range(len(roll)):
			s[i] = chr((ord(s[i]) - ord('a') + shift[i]) % 26 + ord('a'))
			ans += s[i]
		return ans


class Solution:

	def findRollOut(self, s, roll, n):
		s = list(s)
		for i in range(len(s)):
			s[i] = ord(s[i]) - ord('a')
		add = [0 for i in range(len(s) + 1)]
		for r in roll:
			add[0] += 1
			add[r] -= 1
		accum = 0
		for i in range(len(s)):
			accum += add[i]
			s[i] = chr(ord('a') + (s[i] + accum) % 26)
		return ''.join(s)


class Solution:

	def findRollOut(self, s, roll, n):
		arr = [0] * (n + 1)
		for i in range(n):
			arr[0] += 1
			arr[roll[i]] -= 1
		for i in range(1, n):
			arr[i] += arr[i - 1]
		res = ''
		for i in range(n):
			y = chr((ord(s[i]) - 97 + arr[i]) % 26 + 97)
			res += y
		return res


import collections

class Solution:

	def findRollOut(self, s, roll, n):
		prefix = [0] * (n + 1)
		a_to_z = [chr(i) for i in range(97, 97 + 26)]
		for i in range(len(roll)):
			prefix[0] += 1
			prefix[roll[i]] -= 1
		for i in range(1, n):
			prefix[i] += prefix[i - 1]
		res = ''
		for i in range(n):
			num = ord(s[i]) + prefix[i] - 97
			num = num % 26
			res += a_to_z[num]
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		length = len(s)
		arr = [0] * length
		for num in roll:
			arr[num - 1] += 1
		total_sum = len(roll)
		new_str = ''
		for idx in range(len(arr)):
			to_roll = total_sum % 26
			ord_char = ord(s[idx])
			new_ord = ord_char + to_roll
			if new_ord > 122:
				new_ord -= 26
			new_str += chr(new_ord)
			total_sum = total_sum - arr[idx]
		return new_str


class Solution:

	def findRollOut(self, s, roll, n):
		ls = [0] * len(s)
		for x in roll:
			ls[x - 1] += 1
		ls1 = ls[::-1]
		for i in range(1, len(s)):
			ls1[i] = ls1[i] + ls1[i - 1]
		ls2 = ls1[::-1]
		lss = []
		for x in s:
			lss.append(x)
		for i in range(len(ls2)):
			ss = ls2[i]
			re = ss % 26
			if int(ord(lss[i])) + re > 122:
				lss[i] = chr(96 + (int(ord(lss[i])) + re) % 122)
			else:
				lss[i] = chr(int(ord(lss[i])) + re)
		return ''.join(lss)


class Solution:

	def findRollOut(self, s, roll, n):
		res = ''
		rolling = [0] * (n + 1)
		for i in range(n):
			rolling[roll[i]] += 1
		for i in range(n - 1, -1, -1):
			rolling[i] = rolling[i] + rolling[i + 1]
		for i in range(n):
			pos = ord(s[i]) - ord('a')
			pos = pos + rolling[i + 1]
			res += chr(ord('a') + pos % 26)
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		a = [0] * n
		for i in roll:
			a[i - 1] += 1
		c = n
		for i in range(n):
			(c, a[i]) = (c - a[i], chr(97 + (ord(s[i]) + c - 97) % 26))
		return ''.join(a)


class Solution:

	def findRollOut(self, s, roll, n):
		i = 0
		st = 'abcdefghijklmnopqrstuvwxyz'
		arr = [0] * n
		for i in range(n):
			arr[roll[i] - 1] += 1
		arr = arr[::-1]
		for i in range(1, n):
			arr[i] += arr[i - 1]
		arr = arr[::-1]
		ans = ''
		for i in range(n):
			ans += st[(ord(s[i]) - 97 + arr[i]) % 26]
		return ans


import string

class Solution:

	def findRollOut(self, s, roll, n):
		dp = [0] * n
		for i in range(n):
			if roll[i] != 0:
				dp[0] += 1
				if roll[i] < n:
					dp[roll[i]] -= 1
		for i in range(1, n):
			dp[i] += dp[i - 1]
		ans = ''
		for (idx, i) in enumerate(s):
			ans += chr((ord(i) - 97 + dp[idx]) % 26 + 97)
		return ans


import string

class Solution:

	def findRollOut(self, s, roll, n):
		roll_counts = [0] * len(roll)
		for count in roll:
			roll_counts[count - 1] += 1
		ascii = 'abcdefghijklmnopqrstuvwxyz'
		result = ''
		roll_count = 0
		for i in range(n - 1, -1, -1):
			roll_count += roll_counts[i]
			char_index = string.ascii_lowercase.index(s[i])
			roll_char = string.ascii_lowercase[(char_index + roll_count) % 26]
			result = roll_char + result
		return result


class Solution:

	def findRollOut(self, s, roll, n):
		num_shifts = [0 for i in roll]
		for i in roll:
			num_shifts[i - 1] += 1
		curr = num_shifts[-1]
		for i in range(len(num_shifts) - 2, -1, -1):
			if num_shifts[i] != 0:
				num_shifts[i] += curr
				curr = num_shifts[i]
			else:
				num_shifts[i] = curr
		new_string = [0] * len(s)
		for i in range(len(s)):
			shift = num_shifts[i]
			temp = ord(s[i]) + num_shifts[i] % 26
			if temp > 122:
				temp -= 26
			new_string[i] = chr(temp)
		return ''.join(new_string)


class Solution:

	def findRollOut(self, s, roll, n):
		roll_l = [0 for i in roll]
		for i in roll:
			roll_l[i - 1] += 1
		curr = roll_l[-1]
		for i in range(len(roll_l) - 2, -1, -1):
			if roll_l[i] != 0:
				roll_l[i] += curr
				curr = roll_l[i]
			else:
				roll_l[i] = curr
		ans = ''
		start = ord('a')
		for i in range(len(roll_l)):
			curr_c = ord(s[i])
			curr_c -= start
			curr_c += roll_l[i]
			curr_c %= 26
			temp_char = chr(curr_c + start)
			ans += temp_char
		return ans


class Solution:

	def findRollOut(self, s, roll, n):
		roll_l = [0 for i in roll]
		for i in roll:
			roll_l[i - 1] += 1
		curr = roll_l[-1]
		for i in range(len(roll_l) - 2, -1, -1):
			if roll_l[i] != 0:
				roll_l[i] += curr
				curr = roll_l[i]
			else:
				roll_l[i] = curr
		ans = ''
		start = ord('a')
		for i in range(len(roll_l)):
			curr_c = ord(s[i])
			curr_c -= start
			curr_c += roll_l[i]
			curr_c %= 26
			temp_char = chr(curr_c + start)
			ans += temp_char
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		s = input()
		a = list(map(int, input().split()))
		ob = Solution()
		ans = ob.findRollOut(s, a, n)
		print(ans)


import string

class Solution:

	def findRollOut(self, s, roll, n):
		roll_counts = list((0 for i in range(n)))
		for count in roll:
			roll_counts[count - 1] += 1
		ascii = 'abcdefghijklmnopqrstuvwxyz'
		result = ''
		roll_count = 0
		for i in range(n - 1, -1, -1):
			roll_count += roll_counts[i]
			char_index = string.ascii_lowercase.index(s[i])
			roll_char = string.ascii_lowercase[(char_index + roll_count) % 26]
			result = roll_char + result
		return result
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		s = input()
		a = list(map(int, input().split()))
		ob = Solution()
		ans = ob.findRollOut(s, a, n)
		print(ans)


class Solution:

	def findRollOut(self, s, roll, n):
		m = len(roll)
		operations = [0] * (n + 2)
		for i in range(m):
			operations[roll[i]] += 1
		for i in range(n, 0, -1):
			operations[i] += operations[i + 1]
		result = list(s)
		for i in range(n):
			result[i] = chr((ord(result[i]) - ord('a') + operations[i + 1]) % 26 + ord('a'))
		return ''.join(result)
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		s = input()
		a = list(map(int, input().split()))
		ob = Solution()
		ans = ob.findRollOut(s, a, n)
		print(ans)


class Solution:

	def findRollOut(self, s, roll, n):

		def fun(ch, inc):
			val = ord(ch) - ord('a')
			val += inc
			val = val % 26
			return chr(val + ord('a'))
		s = list(s)
		arr = [0] * n
		roll.sort()
		(i, j) = (0, 0)
		while i < n and j < n:
			if i < roll[j]:
				arr[i] += n - j
				i += 1
			else:
				j += 1
		for i in range(n):
			s[i] = fun(s[i], arr[i])
		return ''.join(s)
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		s = input()
		a = list(map(int, input().split()))
		ob = Solution()
		ans = ob.findRollOut(s, a, n)
		print(ans)


from collections import defaultdict

class Solution:

	def findRollOut(self, s, roll, n):
		a = defaultdict(int)
		b = defaultdict(int)
		for i in range(n):
			a[roll[i]] += 1
		for i in range(n):
			b[i + 1] = n
		cnt = a[1]
		for i in range(2, n + 1):
			b[i] -= cnt
			cnt += a[i]
		ans = ''
		for i in b:
			ans += chr((ord(s[i - 1]) - 97 + b[i]) % 26 + 97)
		return ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		s = input()
		a = list(map(int, input().split()))
		ob = Solution()
		ans = ob.findRollOut(s, a, n)
		print(ans)


class Solution:

	def findRollOut(self, s, roll, n):
		hash = [0] * (n + 2)
		ls = list(s)
		for i in range(n):
			hash[roll[i]] += 1
		for i in range(n, -1, -1):
			hash[i] += hash[i + 1]
		for i in range(1, n + 1):
			x = ord(ls[i - 1]) - ord('a')
			ls[i - 1] = chr((x + hash[i]) % 26 + ord('a'))
		return ''.join(ls)
if __name__ == '__main__':
	t = int(input())
	for _ in range(0, t):
		n = int(input())
		s = input()
		a = list(map(int, input().split()))
		ob = Solution()
		ans = ob.findRollOut(s, a, n)
		print(ans)


class Solution:

	def findRollOut(self, s, roll, n):
		sortedroll = sorted(roll)
		prev = 0
		leng = len(roll)
		res = ''
		temp = ''
		for x in sortedroll:
			if prev != x:
				temp = s[prev:x]
				for i in temp:
					if ord(i) + leng > 122:
						res += chr(97 + (ord(i) - 97 + leng) % 26)
					else:
						res += chr(97 + (ord(i) - 97 + leng) % 26)
				prev = x
				leng -= 1
			else:
				leng -= 1
		res += s[prev:]
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		brr = [0] * (n + 1)
		for i in range(0, n):
			brr[0] += 1
			brr[roll[i]] -= 1
		for i in range(1, n):
			brr[i] += brr[i - 1]
		ch = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
		ans = ''
		for i in range(0, n):
			x = brr[i] % 26
			y = ord(s[i]) - 97
			ans += ch[(x + y) % 26]
		return ans


class Solution:

	def findRollOut(self, s, roll, n):
		lst = [0 for i in range(n)]
		for i in roll:
			lst[i - 1] += 1
		for i in range(len(lst) - 2, -1, -1):
			lst[i] += lst[i + 1]
			lst[i] = lst[i] % 26
		for i in range(len(s)):
			s = s[:i] + chr(97 + (ord(s[i]) + lst[i] - 97) % 26) + s[i + 1:]
		return s


class Solution:

	def findRollOut(self, s, roll, n):
		hash = [0] * (n + 2)
		ls = list(s)
		for i in range(n):
			hash[roll[i]] += 1
		for i in range(n, -1, -1):
			hash[i] += hash[i + 1]
		for i in range(1, n + 1):
			x = ord(ls[i - 1]) - ord('a')
			ls[i - 1] = chr((x + hash[i]) % 26 + ord('a'))
		return ''.join(ls)


class Solution:

	def findRollOut(self, s, roll, n):
		count = [0] * len(s)
		for i in roll:
			count[i - 1] += 1
		arr = [sum(count)]
		for i in range(len(count) - 1):
			arr.append(arr[-1] - count[i])
		s = list(s)
		for (i, char) in enumerate(s):
			rollto = ord(char) + arr[i] - 96
			rollto = rollto % 26
			if rollto == 0:
				count[i] = 'z'
			else:
				count[i] = chr(rollto + 96)
		return ''.join(count)


class Solution:

	def findRollOut(self, s, roll, n):
		total = [0] * len(roll)
		for num in roll:
			if num > 0:
				total[0] += 1
				if num < n:
					total[num] -= 1
		for i in range(1, n):
			total[i] = total[i - 1] + total[i]
		res = []
		for i in range(len(s)):
			ch = s[i]
			current_ascii = ord(ch) - ord('a')
			added_ascii = (current_ascii + total[i]) % 26
			res.append(chr(ord('a') + added_ascii))
		return ''.join(res)


class Solution:

	def findRollOut(self, s, roll, n):
		m = len(roll)
		hash = [0] * (n + 2)
		for i in range(m):
			hash[roll[i]] += 1
		for i in range(n, 0, -1):
			hash[i] += hash[i + 1]
		s_list = list(s)
		for i in range(n):
			s_list[i] = chr((ord(s_list[i]) - ord('a') + hash[i + 1]) % 26 + ord('a'))
		return ''.join(s_list)


import numpy as np

class Solution:

	def findRollOut(self, s, roll, n):
		rolling = np.zeros(len(s))
		for i in roll:
			rolling[:i] += 1
		base = ord('a')
		res = ''
		for j in range(len(s)):
			offset = ord(s[j]) - base
			newOffset = int((offset + rolling[j]) % 26)
			res += chr(base + newOffset)
		return res


class Solution:

	def findRollOut(self, s, roll, n):
		length = len(s)
		loops = [0] * length
		for r in roll:
			loops[0] += 1
			if r < length:
				loops[r] -= 1
		for i in range(1, length):
			loops[i] += loops[i - 1]
		output = ''
		for i in range(length):
			output += chr((ord(s[i]) + loops[i] - 97) % 26 + 97)
		return output


class Solution:

	def findRollOut(self, s, roll, n):
		t = [0] * n
		for j in roll:
			t[j - 1] += 1
		total = sum(t)
		final = ''
		for j in range(n):
			v = ord(s[j]) + total % 26
			while v > 122:
				v -= 26
			final += chr(v)
			total -= t[j]
		return final


class Solution:

	def findRollOut(self, s, roll, n):
		s = list(s)
		l = [0] * (n + 1)
		for i in range(n):
			l[0] = l[0] + 1
			l[roll[i]] = l[roll[i]] - 1
		for i in range(1, n):
			l[i] = l[i] + l[i - 1]
		for i in range(0, n):
			r = l[i] % 26
			r = ord(s[i]) + r
			if r > 122:
				r = r - 122 + 96
			s[i] = chr(r)
		return ''.join(s)


class Solution:

	def findRollOut(self, s, roll, n):
		rolls = sorted(roll)
		roll_index = 0
		chars = list(s)
		for position in range(1, n + 1):
			while roll_index < len(rolls) and position > rolls[roll_index]:
				roll_index += 1
			rotations = len(roll) - roll_index
			char_rank = ord(chars[position - 1]) - ord('a') + rotations
			char_rank_adjusted = char_rank % 26
			chars[position - 1] = chr(char_rank_adjusted + ord('a'))
		return ''.join(chars)
		rotations = [0] * len(s)
		for rolls in roll:
			for i in range(rolls):
				rotations[i] += 1
		for i in range(len(rotations)):
			rotations[i] = chr((ord(s[i]) - ord('a') + rotations[i]) % 26 + ord('a'))
		return ''.join(rotations)


class Solution:

	def findRollOut(self, s, roll, n):
		s = list(s)
		from collections import Counter
		arr = Counter(roll)
		for i in range(n, -1, -1):
			arr[i] += arr[i + 1]
		for i in range(1, n + 1):
			s[i - 1] = chr((ord(s[i - 1]) - ord('a') + arr[i]) % 26 + ord('a'))
		return ''.join(s)


class Solution:

	def findRollOut(self, s, roll, n):
		a = [0] * len(s)
		ans = ''
		for i in range(0, len(roll)):
			a[roll[i] - 1] += 1
		for i in range(len(roll) - 2, -1, -1):
			a[i] += a[i + 1]
		for i in range(0, len(a)):
			a[i] = a[i] % 26
			asc = ord(s[i]) + a[i] - 122 + 96 if ord(s[i]) + a[i] > 122 else ord(s[i]) + a[i]
			ans += chr(asc)
		return ans


class Solution:

	def findRollOut(self, s, roll, n):
		output = []
		chmp = [chr(i) for i in range(97, 123)]
		roll.sort()
		i = 0
		j = 0
		while len(roll) != 0:
			ch = s[j]
			output.append((ord(ch) + len(roll) - 97) % 26)
			while roll != [] and roll[0] <= len(output):
				roll.pop(0)
			j += 1
		return ''.join((chmp[k] for k in output)) + s[j:]