主页 讨论版 问题 名次 状态 统计

请自觉遵守比赛规则,违者严惩,不接受求情!

问题 K: K=1 Problem of Orz Pandas

问题 K: K=1 Problem of Orz Pandas

时间限制:1000 ms 内存限制:128 MB
提交:102 解决:44
[ 提交][ 状态][ 讨论版]

题目描述

One panda named orz is playing a interesting game, he gets a big integerNumand an integerK. In this game, he can exchange two single numbers inNum. For example, he can get 1243 from 3241 by exchange 1 and 3.But orz can exchange at mostKtimes. So what’s the biggest number after at mostKtimes operations?

However, a VIP (Very Important Panda) of ACM/OPPC (Orz Panda Programming Contest) comittee thought this problem was too hard for Orz Pandas. So he simplified this problem with constraintK=1. Your task is to solve the simplified problem.

输入

Multiple cases. For each case:
The first line is an integer Num. 0 ≤ Num ≤ 101000, and it is guaranteed that Num is a legal integer and doesn’t contain any leading zero

输出

For each test case, print the biggest number after at most 1 times operation in a line.

样例输入

12345 23

样例输出

52341 32

提示

[ 提交][ 状态][ 讨论版]
Baidu
map