word of lowercase English letters, a number of rounds rounds, and an array spans of 26 numbers, one for each letter from a to z.
In one round, every letter of the word is replaced at the same time by the spans[i] letters that follow it in the alphabet (i is the letter's position, with a at 0). The alphabet wraps around, so a comes again after z. For example, if the span of x is 4, then x becomes yzab.
Return the length of the word after exactly rounds rounds. The answer can be huge, so return it modulo 10⁹ + 7.word='az', rounds=2, spans=[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3] → 6
After the first round a turns into bc and z into abc, giving bcabc. In the second round each b and c yields one letter and a yields two: cd + bc + cd = cdbccd, length 6.
word='m', rounds=3, spans=[25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25] → 15625
Every letter becomes 25 letters per round, so after three rounds the length is 25³ = 15625.
word='hello', rounds=1, spans=[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] → 5
word consists of lowercase English letters onlyword='az', rounds=2, spans=[2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3]
6
Run checks the first 3 tests in your browser. Submit checks all 108 tests on the server, hidden ones included.