LogiQuest

108. Count Palindromic Substrings

MediumExpand Around Centre

Count the palindromic substrings of s (substrings at different positions are counted separately).

Input format

A single line of lowercase letters.

Output format

The count.

Example 1

Input

abc

Output

3

Example 2

Input

aaa

Output

6

Constraints

1 ≤ |s| ≤ 1000

Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.

Loading the MyLoginn IDE…