- Time limit: 1.00 s
- Memory limit: 512 MB
You are a given a string of length . Find the length of the shortest palindrome that is a substring of and is at least 2 characters long, or report that no such substring exists. consists of lowercase Latin alphabet.
Input
A single line contains a string .
Output
Print the length of the shortest palindromic substring or -1 if no such string exists.
Constraints
Example 1
Input:
abba
Output:
2
Example 2
Input:
zsyad
Output:
-1
Example 4
Input:
aybabtu
Output:
3