Problem Statement
A string $T$ is called a good string when it satisfies the following condition:
- There is a pair of strings
$(A, B)$that satisfies all of the following: - Both
$A$and$B$are non-empty.$A + B = T$.- Both
$A + \mathrm{rev}(B)$and$\mathrm{rev}(A) + B$are palindromes.
Here, $A + B$ denotes the string formed by concatenating strings $A$ and $B$ in this order.
Also, $\mathrm{rev}(A)$ denotes the string formed by reversing the order of the characters in string $A$.
There is a string $S$ of length $N$ consisting of lowercase English letters and the character ?.
Among the $26^{(\text{number of ?s})}$ ways to replace the ?s in $S$ with lowercase English letters, how many result in a good string? Find the count modulo $998244353$.
Constraints
$2 \leq N \leq 5 \times 10^4$$S$is a string of length$N$consisting of lowercase English letters and?.
Input
The input is given from Standard Input in the following format:
N
S
Output
Print the number, modulo $998244353$, of ways to replace the characters that satisfy the condition in the problem statement.
样例
4
?ba?
1
10
?y?x?x????
676
30
???a?????aab?a???c????c?aab???
193994800
36
????????????????????????????????????
363594614
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。