問題一覧 > 通常問題

No.599 Is It a Palindrome?

レベル : / AI推定難易度 : 1475 / 実行時間制限 : 1ケース 4.000秒 / メモリ制限 : 256 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 113
作問者 : koyumeishi / テスター : conf
お気に入りにしたユーザー ProblemId : 1171 / 自分の提出
問題文最終更新日: 2026-06-25 15:00:24
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 178 (順位表) の他の問題:

Problem Statement

"suidousui" is a palindrome
Is 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もしくは右上の雲マークをクリックしてアカウントを作成してください。