4.3 Symmetricity

Score: 60pts

Time Limit: 5.00 sec

Find number of symmetric substring of length greater than one in a given string N

Constraints

Input string consists of ones and zeros

Input Format

N

Output Format

Number of symmetric substrings of length greater than one

Example 1

Input:

10101

Output:

4

Explanation:

Symmetric substrings of size 3:

From index 0-2

From index 1-3

From index 2-4

Symmetric substrings of size 5:

From index 0-4

10101

Output:

4

Explanation:

Symmetric substrings of size 3:

From index 0-2

From index 1-3

From index 2-4

Symmetric substrings of size 5:

From index 0-4