SP21640 NESPALIN - Nested Palindromes
Description
Palindromes are numbers that read the same forwards and backwards. Your friend Percy recently became interested in a special kind of palindrome that he calls a _Nested Palindrome_. A _Nested Palindrome_ meets three conditions:
- The number is a palindrome.
- Split the number in the middle. The first half of the digits of the number is also a _Nested Palindrome_. If the number has an odd number of digits, don’t consider the middle digit as part of the first half.
- No two adjacent digits are the same.
Percy says that he has written a _Nested Palindrome_ with no leading zeros on a slip of paper. Next, Percy says that he has erased some of the digits in the number and replaced those digits with question marks. He asks you to think about all possible numbers, in increasing order, that can fill those digits and could possibly form the number Percy wrote. Of course, Percy may not be telling the truth about having written a _Nested Palindrome_ in the first place.
Percy tells you that the number he wrote is the **k**th number of this potentially large list. Your task is to find that **k**th number.
Input Format
N/A
Output Format
N/A