MicrosoftOA #4
Roll Operation on String
Estimated MediumJudge-ready
Topics (AI-labelled)Prefix & RangesStrings
Each operation cyclically increments the first k lowercase letters once, with z becoming a. Output the string after performing all operations in order.
Input
The first line contains the string s (1..100000 lowercase letters); the second line contains the number of operations m (1..100000); the third line contains m values of k, with 1≤k≤|s|.
Output
Output the final lowercase string.
Example 1
Input:
abz
3
3 2 1
Output:
dda
Example 2
Input:
z
1
1
Output:
a
Example 3
Input:
abc
2
1 1
Output:
cbc
Example notes
Example 1: the three prefix operations give bca, cda, dda in turn.
Example 2: z cyclically increments to a.
Example 3: only the first character is incremented, twice, so abc becomes cbc.
Editorial
Loading solution…