Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

(This question is a variation of the LeetCode question 564. Find the Closest Palindrome. If you haven't completed that question yet, it is recommended to solve it first.)

Given a string n representing a positive integer, find the smallest palindrome that is greater than n. The result should also be returned as a string.

Test Cases
Input
Output
Expected