You are provided with a numeric string number
that represents a very large palindromic number.
Your task is to return the smallest palindrome greater than number
that can be formed by rearranging its digits. If no such palindrome can be formed, return an empty string ""
.
A palindrome is a number that reads identically forwards and backwards.
Input: number = "1331" Output: "3113" Explanation: The next palindrome larger than "1331" formed by rearranging digits is "3113".
Input: number = "45654" Output: "" Explanation: No palindrome greater than "45654" can be created by rearranging its digits.
Input: number = "788877" Output: "877778" Explanation: The next palindrome larger than "788877" is "877778".
1 <= number.length <= 8 * 104
number
is guaranteed to be a palindrome.