시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
2 초 512 MB 2 2 2 100.000%

문제

Given a string $A$ of length $n$. Consider palindromic substrings of this string. Each palindromic substring is defined by its starting position $s$ and its end $e$ ($1 \le s \le e \le n$) such that letters in $A$ starting at position $s$ and ending at position $e$, inclusive, form a palindrome (i.e. $A[s+i]=A[e-i]$ for any integer $i$ between 0 and $e-s$, inclusive).

Let's define an embedding of depth $k \ge 1$ as a sequence of $k$ palindromic substrings of $A$ with the following property: $s_1 < \ldots < s_k$ and $e_1 > \ldots > e_k$, i.e. palindromes in the embedding are strictly contained in each other like the Russian dolls.

Given $A$, count the number of possible embeddings. Since this number can be too large, calculate it modulo $998\,244\,353$.

입력

The input consists of a single line containing the string $A$. The string is non-empty and consists of no more than $10^6$ lowercase English letters.

출력

Print the number of possible embeddings modulo $998\,244\,353$.

예제 입력 1

bonobo

예제 출력 1

16

예제 입력 2

banana

예제 출력 2

18

힌트

For the sample input 1, we have nine embeddings of depth 1 (1-1, 2-2, 3-3, 4-4, 5-5, 6-6, 2-4, 4-6, 1-5), six embeddings of depth 2 (3-3 in 2-4, 5-5 in 4-6, 2-2 in 1-5, 3-3 in 1-5, 4-4 in 1-5, 2-4 in 1-5), and one embedding of depth 3 (3-3 in 2-4 in 1-5), with $9+6+1=16$  embeddings in total.