All Tracks Algorithms String Algorithms Basics of String Manipulation Problem

Palindromes
Tag(s):

Basic Programming, Easy, Implementation, String

Problem
Editorial
Analytics

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

SAMPLE INPUT
aba
SAMPLE OUTPUT
2
Explanation

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

Time Limit: 3.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

McAfee, Part of Intel Security

Challenge Name

McAfee, Part of Intel Security

OTHER PROBLEMS OF THIS CHALLENGE
  • Basic Programming > Implementation
Notifications
View All Notifications

?