Fibonacci Strings
Time limit2sMemory limit1024 MB
Given k (0 to 80), find the length of the longest palindrome that appears as a substring of the k-th Fibonacci string.
Statement
Alla loves palindromes. Her name is a palindrome itself. A string is a palindrome if it reads the same from left to right and from right to left.
One day a teacher at school told Alla about so-called Fibonacci strings.
Fibonacci strings are defined as follows:
- for every , the concatenation of the two previous Fibonacci strings.
So the first five Fibonacci strings are a, b, ba, bab, and babba.
Alla wants to know the longest palindrome that appears in the -th Fibonacci string. Help her solve this problem.
Input
The first line contains one integer (), the index of the Fibonacci string.
Output
Print the length of the longest palindrome contained in the -th Fibonacci string.