## DMOPC '21 Contest 6 P1 - Bigger Big Integer

View as PDF

Points: 3 (partial)
Time limit: 3.0s
Memory limit: 1G

Author:
Problem type

Bob is working as a data scientist, which basically means he stares at big integers all day. Bob loves big integers, and loves making them as big as possible. He is currently staring at an integer consisting of non-zero digits, and wants to make it bigger. However, since he doesn't want to mess up the database too much and potentially get fired, he limits himself to swapping at most one pair of adjacent digits of the integer. What is the biggest integer he can create by doing so?

#### Constraints

All digits of are non-zero.

#### Input Specification

The first line contains an integer .

The second line contains a -digit integer .

#### Output Specification

Output the largest integer Bob can create by swapping at most one pair of adjacent digits of .

#### Sample Input 1

20
32249178991231416774

#### Sample Output 1

32429178991231416774

#### Sample Input 2

5
54321

#### Sample Output 2

54321