cf/mirror

String Coloring (hard version)

CF
1296E22000· candidate master1s256 MB⌨ stdin/stdout

Examples

Sample 1of 4
Input
9
abacbecfd
Output
2
1 1 2 1 2 1 2 1 2
Sample 2of 4
Input
8
aaabbcbb
Output
2
1 2 1 2 1 2 1 1
Sample 3of 4
Input
7
abcdedc
Output
3
1 1 1 1 1 2 3
Sample 4of 4
Input
5
abcde
Output
1
1 1 1 1 1
1296E2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)