word of lowercase English letters and an array rolls of the same length. Moving a letter means replacing it with the next one in the alphabet, with 'a' coming after 'z'.
For each i, the value rolls[i] means the first i + 1 letters of the string are each moved rolls[i] times.
Return the string you get after all the moves.word='dog', rolls=[1, 2, 3] → 'jtj'
The first letter is moved by all three rolls, 1 + 2 + 3 = 6, so 'd' → 'j'. The second by the last two, 5, so 'o' → 't'. The third by the last one only, 3, so 'g' → 'j'. The result is "jtj".
word='zz', rolls=[1, 0] → 'az'
The first 'z' moves by 1 and wraps around to 'a', the second stays put: "az".
word='m', rolls=[52] → 'm'
52 steps are exactly two full circles, so the letter does not change.
word.length ≤ 10⁵word consists of lowercase English lettersrolls.length == word.lengthrolls[i] ≤ 10⁹word='dog', rolls=[1, 2, 3]
'jtj'
Run checks the first 3 tests in your browser. Submit checks all 81 tests on the server, hidden ones included.