A Palindrome Problem

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

You are given a string A. You want to remove the most number of characters to make the string a palindrome.

A palindrome is defined as a string of length greater than or equal to 1 that is the same forwards as it is backwards.

Input Specification

The first line will contain the string A\ (1 \le |A| \le 10^5). A is guaranteed to only contain lowercase alphabetical characters.

Output Specification

Print the maximum number of characters that can be removed to make the string a palindrome.

Sample Input

jsumabatroooheart

Sample Output

16

Comments

There are no comments at the moment.