#C10599. Count Symmetric Strings
Count Symmetric Strings
Count Symmetric Strings
You are given a positive integer N
. Your task is to determine the number of symmetric strings of length N
that can be formed using only lowercase English letters. A symmetric string is a string that reads the same forwards and backwards.
For example, for N = 3
, the string aba
is symmetric, but abc
is not.
The number of symmetric strings can be computed as follows:
- If
N
is even, the answer is \(26^{\frac{N}{2}} \mod (10^9+7)\). - If
N
is odd, the answer is \(26^{\frac{N+1}{2}} \mod (10^9+7)\).
Note: All arithmetic should be done modulo \(10^9+7\).
inputFormat
The first line of input contains a single integer T
, denoting the number of test cases.
Each of the following T
lines contains one integer N
, the length of the string.
outputFormat
For each test case, output the number of symmetric strings of length N
modulo 10^9+7
. Output each result on a new line.
1
1
26
</p>