시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 (추가 시간 없음) | 1024 MB | 1 | 1 | 1 | 100.000% |
Grammy had a unique insight about strings. She thinks that a string is positive if and only if it is lexicographically larger than its reversal.
Now you are given a string, please find out how many contiguous substrings of it are positive according to Grammy's insight.
The single line contains a string $S$ ($1 \leq |S| \leq 200\,000$), consisting of lowercase English letters only.
Output a single integer denoting the number of positive substrings of $S$.
jjikkollp
4
pbpbppb
7