P1609 Smallest Palindromic Number
Description
A palindromic number is a number that reads the same from left to right and from right to left.
For example: $121$, $44$, and $3$ are palindromic numbers, while $175$ and $36$ are not.
Given a number $N$, find a palindromic number $P$ such that $P > N$.
There are many such palindromic numbers; your task is to output the smallest one.
Input Format
One line containing a positive integer $N$. The value of $N$ is less than $10^{100}$, and $N$ has no leading $0$.
Output Format
Your program should output one line: the smallest palindromic number $P$ with $P > N$.
Explanation/Hint
For $50\%$ of the testdata, $N < 10^9$.
For $100\%$ of the testdata, $N < 10^{100}$.
Translated by ChatGPT 5