Palindromic Sub-String <P2SME>
Tag(s):

## Basic Programming, Easy, String

Problem
Editorial
Analytics

You are given a string S. You have to check if there exists a sub-string X of string S having length greater than 1 such that the string X and its palindrome both are present as sub-string in the string S.

Note: String X and its palindrome string may overlap.

Input
First line contains a string S as input.

Output
Print YES if there is a sub-string X as described above and in the next line print the length of maximum sub-string among all that satisfies this condition.
If there is no sub-string that satisfies the above condition print NO.

Constraints
$1 \le |S| \le 50$ where S is the length of string S.
String S contains lowercase English letters only.

Help on using the given code snippet
Suppose that your answer is NO then you need to return the string NO or else you have to return the string YES . "\n" . $val where$val is the answer. The two ways of using the given code snippet are shown below

function process_string ($S) { // Complete this function and return the appropriate value // The format of returning the value if explained above return "NO"; } function process_string ($S)
{

// Complete this function and return the appropriate value
// The format of returning the value if explained above
return "YES" . "\n" . \$val;
}


Note: It is not mandatory to use the code snippet that is provided to you in the editor by default. It is just to make the question more convenient. You can completely remove the default code and submit your solution in the appropriate format.

SAMPLE INPUT
hackeratrekcah

SAMPLE OUTPUT
YES
6
Explanation

In the first sample S = hackeratrekcah you can see that there is a sub-string X = hacker whose palindrome also exists in the string S and it is largest among all.

Time Limit: 5.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...

## This Problem was Asked in

Challenge Name

Power2SME PHP Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
• Algorithms > Dynamic Programming
• Data Structures > Advanced Data Structures