Palindromes

4.1

33 votes
Approved, Basic Programming, Easy, Implementation, Open, String Manipulation
Problem

Everybody loves palindromes, but Artur doesn't.
He has a string S that consists of lowercase English letters ('a' - 'z'). Artur wants to find a substring T of S of the maximal length, so that T isn't a palindrome.

Input
The input contains a single line, containing string S. String S consists of lower case English letters.

Output
In a single line print the length of T

Constraints
1 ≤ |S| ≤ 100000

Time Limit: 3
Memory Limit: 256
Source Limit:
Explanation

"aba" is a palindrome, but "ab" isn't.

Editor Image

?