#arc148b. [arc148_b]dp

[arc148_b]dp

Problem Statement

For a string TT of length LL consisting of d and p, let f(T)f(T) be TT rotated 180180 degrees. More formally, let f(T)f(T) be the string that satisfies the following conditions.

  • f(T)f(T) is a string of length LL consisting of d and p.
  • For every integer ii such that 1leqileqL1 \\leq i \\leq L, the ii-th character of f(T)f(T) differs from the (L+1i)(L + 1 - i)-th character of TT.

For instance, if T=T = ddddd, f(T)=f(T) = ppppp; if T=T = dpdppp, f(T)=f(T)= dddpdp.

You are given a string SS of length NN consisting of d and p.
You may perform the following operation zero or one time.

  • Choose a pair of integers (L,R)(L, R) such that 1leqLleqRleqN1 \\leq L \\leq R \\leq N, and let TT be the substring formed by the LL-th through RR-th characters of SS. Then, replace the LL-th through RR-th characters of SS with f(T)f(T).

For instance, if S=S= dpdpp and (L,R)=(2,4)(L,R)=(2,4), we have T=T= pdp and f(T)=f(T)= dpd, so SS becomes ddpdp.

Print the lexicographically smallest string that SS can become.

What is lexicographical order?

A string S=S1S2ldotsSSS = S_1S_2\\ldots S_{|S|} is said to be lexicographically smaller than a string T=T1T2ldotsTTT = T_1T_2\\ldots T_{|T|} if one of the following 1. and 2. holds. Here, S|S| and T|T| denote the lengths of SS and TT, respectively.

  1. SltT|S| \\lt |T| and S1S2ldotsSS=T1T2ldotsTSS_1S_2\\ldots S_{|S|} = T_1T_2\\ldots T_{|S|}.
  2. There is an integer 1leqileqminlbraceS,Trbrace1 \\leq i \\leq \\min\\lbrace |S|, |T| \\rbrace that satisfies the following two conditions:
    • S1S2ldotsSi1=T1T2ldotsTi1S_1S_2\\ldots S_{i-1} = T_1T_2\\ldots T_{i-1}.
    • SiS_i is smaller than TiT_i in alphabetical order.

Constraints

  • 1leqNleq50001 \\leq N \\leq 5000
  • SS is a string of length NN consisting of d and p.
  • NN is an integer.

Input

The input is given from Standard Input in the following format:

NN SS

Output

Print the answer.


Sample Input 1

6
dpdppd

Sample Output 1

dddpdd

Let (L,R)=(2,5)(L, R) = (2, 5). Then, we have T=T = pdpp and f(T)=f(T) = ddpd, so SS becomes dddpdd.
This is the lexicographically smallest string that can be obtained, so print it.


Sample Input 2

3
ddd

Sample Output 2

ddd

It may be optimal to skip the operation.


Sample Input 3

11
ddpdpdppddp

Sample Output 3

ddddpdpdddp