#P11279. 「GFOI Round 2」Abstract String Basic

    ID: 10339 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>洛谷原创Special JudgeO2优化洛谷月赛

「GFOI Round 2」Abstract String Basic

Description

Charlie is taking a course called Basics of Abstract Strings.

Definition 3.1: For two lowercase strings SS and TT of the same length, their similarity is defined as the number of matching characters in corresponding positions. Formally, if S=T=n|S| = |T| = n, then the similarity between SS and TT is given by $\psi(S, T) = \sum\limits_{i=1}^n \sum\limits_{j=1}^n [i = j][S_i = T_j]$.

Lemma 3.1: For any lowercase string SS, there exists a unique lowercase string TT that maximizes ψ(S,T)\psi(S, T).

Proof of Lemma 3.1: ...

Charlie’s mind begins to wander, and he starts scribbling aimlessly on his paper. Suddenly, he comes up with a new idea: what if he defines the dissimilarity between SS and TT as the number of pairs where both the position and the character are different? Formally, this similarity can be defined as $\tilde{\psi}(S, T) = \sum\limits_{i=1}^n \sum\limits_{j=1}^n [i \neq j][S_i \neq T_j]$. This whimsical definition snaps Charlie out of his daydream. Now, he wonders: what kind of lowercase string TT would maximize the dissimilarity between SS and TT?

Note: The square brackets [x][x] represent Iverson brackets, which evaluate to 11 if the condition xx is true, and 00 otherwise.

Input Format

The first line contains a positive integer nn.

The second line contains a string SS of length nn, consisting only of lowercase letters.

Output Format

Output a single line containing a lowercase string TT, representing your answer. You need to maximize the dissimilarity between SS and TT. If there are multiple answers, output any.

9
cbbccxxxx
godfather
26
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
28
aabcdefghijklmnopqrstuvwxyzz
cybcdefghijklmnopqrstuvwxycy

Hint

Sample 11 Explanation

When T=godfatherT = \texttt{godfather}, ψ~(S,T)=72\tilde{\psi}(S, T) = 72, reaching the maximum value. Note that there may be more than one valid answer.

Subtasks and Constraints

Subtask ID nn\le Special Properties Score
00 2828 Tests are samples 00
11 44 No 2020
22 10610^6 SS doesn't contain the character z
33 10310^3 No
44 10610^6 4040

For all tests, it is guaranteed that:

  • 1n1061 \le n \le 10^6;
  • SS consists only of lowercase letters.