#abc375d. D - ABA
D - ABA
Score : points
问题陈述
给定一个由大写英文字母组成的字符串 。
找出满足以下两个条件的整数三元组 的数量:
- 按照 、 和 的顺序连接形成的三字符长度字符串是一个回文。
这里, 表示 的长度, 表示 的第 个字符。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given a string consisting of uppercase English letters.
Find the number of integer triples satisfying both of the following conditions:
- The length- string formed by concatenating , , and in this order is a palindrome.
Here, denotes the length of , and denotes the -th character of .
Constraints
- is a string of length between and , inclusive, consisting of uppercase English letters.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
ABCACC
Sample Output 1
5
The triples satisfying the conditions are $(i, j, k) = (1, 2, 4), (1, 3, 4), (3, 4, 5), (3, 4, 6), (3, 5, 6)$.
Sample Input 2
OOOOOOOO
Sample Output 2
56
Sample Input 3
XYYXYYXYXXX
Sample Output 3
75