PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#DSU0000035. Dịch vòng bảng chữ cái (Phase Shift)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Dịch vòng bảng chữ cái (Phase Shift)

Phase Shift

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

Take the 2626 lowercase English letters and arrange them secretly around one circle, with every letter appearing exactly once. To encode a string ss, replace every letter with the next letter clockwise on the circle; the last letter is followed by the first. This produces an encoded string tt.

You know tt but not the circular ordering. A valid ordering must contain all 2626 letters in one single cycle, not several disjoint cycles. Every occurrence of the same letter is encoded using the same mapping.

Recover the lexicographically smallest possible original string ss among all strings that could produce tt under some valid circular ordering.

Input

The first line contains nn. The second line contains a length-nn string tt consisting only of letters a–z.

Output

Print the lexicographically smallest possible ss.

Subtasks

  • Subtask 1 (20 points): 1≤n≤201\le n\le20; ∣t∣=n|t|=n; tt contains only lowercase letters a–z.
  • Subtask 2 (30 points): 1≤n≤30001\le n\le3000; ∣t∣=n|t|=n; tt contains only lowercase letters a–z.
  • Subtask 3 (50 points): 1≤n≤1051\le n\le10^5; ∣t∣=n|t|=n; tt contains only lowercase letters a–z.

Examples

Input

2
ba

Output

ac

Explanation

Two encoded letters must have distinct predecessors, and no short cycle is allowed. The smallest valid original string is ac.