#P5685. [JSOI2013] 快乐的 JYY
[JSOI2013] 快乐的 JYY
Description
Given two strings and , representing the names of two of JYY's friends. Let denote the substring of formed by the -th letter through the -th letter. Similarly, we define .
JYY found that the closeness of the relationship between two friends is equal to the number of quadruples that satisfy all of the following conditions:
- .
- .
- .
- is a palindrome string.
Here, denotes the length of string .
JYY hopes you can help him compute the closeness of the relationship between these two friends.
Input Format
The input consists of two lines, each containing a string and made up of uppercase letters.
Output Format
Output one line containing one integer, representing the closeness, i.e., the number of valid quadruples.
PUPPY
PUPPUP
17
Hint
Constraints: .
Translated by ChatGPT 5
京公网安备 11011102002149号