创建于 2026/07/16 · 更新于 2026/07/16
You are given a string of length consisting of lowercase English letters.
You may perform modifications: each modification replaces one position of the string with an arbitrary lowercase English letter. You must, using at most modifications, turn into a Lyndon word.
A non-empty string is a Lyndon word if it is strictly smaller (lexicographically) than every one of its proper suffixes. For example, is a Lyndon word: its proper suffixes are and , and is smaller than both. On the other hand, is not: its proper suffix is smaller than .
It can be proven that such a set of modifications always exists. You only have to output any resulting string that satisfies the constraints.
The first line contains one integer .
The second line contains a string of length consisting of lowercase English letters.
Output one line containing a string of length consisting of lowercase English letters, such that:
If several answers are possible, output any of them.
5
liang
ailng
8
rifleman
iillmmnn