No.599 Is It a Palindrome?
タグ : / 解いたユーザー数 113
作問者 :
koyumeishi
/ テスター :
conf
Problem Statement
"suidousui" is a palindromeIs that really a palindrome!?
Decompose a string $S$ into $k (\geq 1)$ non-empty substrings, and call them $ T_1, T_2, \dots , T_k $ in order from the beginning.
($ S = T_1 + T_2 + \dots + T_k $ , $ |T_i| \geq 1 $)
If $T_i = T_{k-i+1}$ holds for all $i (1 \leq i \leq k)$,
the sequence $T( = [T_1,T_2,\dots,T_k] )$ is called a palindrome-kai decomposition of the string $S$.
Given a string $S$, compute the number of possible palindrome-kai decompositions.
Since the answer can be very large, output it modulo $1,000,000,007$.
Input
$S$
$S$ satisfies the following constraints.
$1 \leq |S| \leq 10^4$
$S$ consists only of lowercase letters 'a' - 'z'
Output
Output the number of possible palindrome-kai decompositions, modulo $1,000,000,007$.
Sample
Sample 1
Input
abc
Output
1
T = ["abc"] is a palindrome-kai decomposition.
Sample 2
Input
suidousui
Output
2
T = ["suidousui"]
T = ["sui", "dou", "sui"]
Sample 3
Input
kaibunkaibunkai
Output
3
T = ["kaibunkaibunkai"]
T = ["kai", "bunkaibun", "kai"]
T = ["kai", "bun", "kai", "bun", "kai"]
Sample 4
Input
aaaaa
Output
4
T = ["aaaaa"]
T = ["aa", "a", "aa"]
T = ["a", "aaa", "a"]
T = ["a", "a", "a", "a", "a"]
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。