403032: GYM100971 M Decomposition into Good Strings

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Decomposition into Good Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Sometimes, in string problems you have to find a string satisfying some conditions. The authors again were too lazy to think of a tricky term for such string, so they called it good.

A string is called good if it contains exactly k different characters. You are given a string s. Find the minimal number of good strings so that their concatenation is s.

Input

The first line contains an integer k (1 ≤ k ≤ 26).

The second line contains a string s (1 ≤ |s| ≤ 200000), consisting of lowercase Latin letters.

Output

For every prefix of s, starting from the prefix consisting of the first character of s, and ending with s itself, output the minimal number of good strings so that their concatenation is this prefix. Solutions will be tested more carefully this way, won't they?

If for some prefix the decomposition into good strings isn't possible, output «-1» for it.

ExamplesInput
2
abacaba
Output
-1 1 1 2 2 3 3

加入题单

算法标签: