提示: 欢迎访问OurACM平台。
Problem 2075 Substring

Accept: 73    Submit: 244
Time Limit: 1000 mSec    Memory Limit : 65536 KB

Problem Description

Given a string, find a substring of it which the original string contains exactly n such substrings.

Input

There are several cases. The first line of each case contains an integer n.The second line contains a string, no longer than 100000.

Output

If the such substring doesn't exist, output "impossible", else output the substring that appeared n times in the original string.If there are multiple solutions, output lexicographic smallest substring.

Sample Input

2 ababba

Sample Output

ab

Source

FOJ有奖月赛-2012年3月

Submit  Back  Status  Discuss