#P1385. 密令

    ID: 380 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>动态规划,dp数学福建省历届夏令营

密令

Description

Given a lowercase string ss, in each operation you may choose a position pp (1p<s1 \leq p \lt |s|) and perform one of the following modifications:

  1. Change sps_p to the letter with lexicographic order +1+1, and change sp+1s_{p+1} to the letter with lexicographic order 1-1.
  2. Change sps_p to the letter with lexicographic order 1-1, and change sp+1s_{p+1} to the letter with lexicographic order +1+1.

After performing any number of operations, into how many different strings can ss be transformed?

During the modifications, ss must always remain a valid lowercase string (that is, you cannot apply lexicographic 1-1 to the letter 'a', and you cannot apply lexicographic +1+1 to the letter 'z'). Output the answer modulo 109+710^9 + 7.

Input Format

The first line contains an integer TT, the number of test cases.

The next TT lines each contain a lowercase string ss.

Output Format

Output TT lines, each containing one integer, the answer for the corresponding test case.

3
aaaaaaaaa
ya
klmbfxzb
0
24
320092793

Hint

  • For 30%30\% of the testdata, T=1T = 1, s10|s| \leq 10.
  • For 60%60\% of the testdata, T10T \leq 10.
  • For 100%100\% of the testdata, T10000T \leq 10000, 1s1001 \leq |s| \leq 100.

Translated by ChatGPT 5