欢迎加入西电微软俱乐部招新群 588166170,做出福利题,免技术部第一次面试且赠送“福利”海报或小礼品~~~~

问题 1124. -- K=1 Problem of Orz Pandas

1124: K=1 Problem of Orz Pandas

时间限制: 1 Sec  内存限制: 128 MB
提交: 89  解决: 39
[提交][状态][讨论版]

题目描述

One panda named orz is playing a interesting game, he gets a big integer Num and an integer K. In this game, he can exchange two single numbers in Num. For example, he can get 1243 from 3241 by exchange 1 and 3.But orz can exchange at most K times. So what’s the biggest number after at most K times 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 constraint K=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

提示

来源

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