← 返回 uber 的题目列表Next Greater Palindrome Number
类型:online_judge
Given a positive integer n, return the smallest palindromic number (in base 10) that is strictly greater than n.
A palindrome is a number whose decimal representation reads the same forwards and backwards.
Output a single integer.
Input
One integer n.
Output
The smallest palindromic integer strictly greater than n.
Constraints (typical interview assumption)
1 <= n <= 10^18 (treat as 64-bit signed integer if not specified).
Examples
Input: 9 Output: 11
Input: 123 Output: 131
Input: 808 Output: 818
Example
Input
9
Output
11