luogu#P6994. [NEERC2014] Joke with permutation

[NEERC2014] Joke with permutation

题目描述

Joey had saved a permutation of integers from 11 to nn in a text file. All the numbers were written as decimal numbers without leading spaces.

Then Joe made a practical joke on her: he removed all the spaces in the file.

Help Joey to restore the original permutation after the Joe's joke!

输入格式

The input file contains a single line with a single string -- the Joey's permutation without spaces.

The Joey's permutation had at least 11 and at most 5050 numbers.

输出格式

Write a line to the output file with the restored permutation. Don’t forget the spaces!

If there are several possible original permutations, write any one of them.

题目大意

给出数字之间无分隔符的 1n1\dots n 的排列构成的字符串,将其还原为合法的排列。

保证 n50n\leq 50,输入数据均保证有解。如有多解输出任一即可。

样例可能有助于你更好理解题意。

4111109876532

4 1 11 10 9 8 7 6 5 3 2

提示

Time limit: 1 s, Memory limit: 256 MB.

Thanks to checker provider:@Arcturus1350 .