Lexicographically Smallest Beautiful String
Scan from the right for the last position that can be raised without making a palindrome, then fill the rest with the smallest safe letters.
Scan from the right for the last position that can be raised without making a palindrome, then fill the rest with the smallest safe letters.