#P5496. 【模板】回文树 / 回文自动机(PAM)
【模板】回文树 / 回文自动机(PAM)
Problem Description
Given a string . It is guaranteed that each character is a lowercase letter. For each position in , find the number of palindromic substrings that end at that position.
This string has been encrypted. Except for the first character, all other characters must be decrypted using the answer from the previous position.
Specifically, if the answer at position is , and the code read for the character at position is , then the actual code of the character at position is . All characters are lowercase letters both before and after encryption.
Input Format
One line containing a string , representing the encrypted string.
Output Format
One line with integers. The -th integer represents the number of palindromic substrings in the original string that end at the -th character.
debber
1 1 1 2 1 1
lwkvjfrphhgkfvzzyx
1 1 2 2 3 1 1 1 1 2 3 1 1 1 1 2 3 4
azzzyyzyyx
1 2 1 2 3 2 2 2 3 3
Hint
Sample Explanation
After decoding, the three samples are respectively:
- ;
- ;
- .
Constraints and Notes
For of the testdata, .
Translated by ChatGPT 5