word and a list of commands moves, where each command is a pair [d, k]:
- d = 0 rotates left by k: move the first letter to the end, k times;
- d = 1 rotates right by k: move the last letter to the front, k times.
Apply all commands in order and return the resulting string.word="rotor", moves=[[0, 2]] → 'torro'
Move the first letter to the end twice: "rotor" → "otorr" → "torro".
word="python", moves=[[1, 1], [0, 3], [1, 8]] → 'python'
Right 1, left 3, right 8 add up to right 6, a full turn for a 6-letter word, so it stays the same.
word="queue", moves=[[1, 2]] → 'ueque'
word="rotor", moves=[[0, 2]]
'torro'
Run checks the first 3 tests in your browser. Submit checks all 86 tests on the server, hidden ones included.