Problem 2663 · Hard

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.

Open the interactive visualisation