#K11436. Count Valid Palindromic Deletions

    ID: 23468 Type: Default 1000ms 256MiB

Count Valid Palindromic Deletions

Count Valid Palindromic Deletions

You are given a string (s). Your task is to delete exactly one character from (s) and determine how many distinct palindromic strings can be obtained. A palindrome is a string that reads the same backward as forward. For example, if (s = "abca"), by removing one character, the valid palindromic outcomes are obtained. Note that duplicates are counted only once. The input string will consist of lowercase English letters only.

Example: For input "aa", removing one character will always yield "a", which is palindromic, so the answer is 1.

Make sure your solution reads from standard input and writes to standard output.

inputFormat

The input consists of a single line containing the string (s).

outputFormat

Output a single integer that represents the number of distinct palindromic strings obtainable after deleting exactly one character from (s).## sample

aa
1