Kotlin Heroes: Episode 7 |
---|

Finished |

The following languages are only available languages for the problems from the contest

Kotlin Heroes: Episode 7:

- Kotlin 1.7.20
- Kotlin 1.9.21

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

*special problem

binary search

greedy

No tag edit access

The problem statement has recently been changed. View the changes.

×
F. Binary String Partition

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLet's call a string $$$t$$$ consisting of characters 0 and/or 1 beautiful, if either the number of occurrences of character 0 in this string does not exceed $$$k$$$, or the number of occurrences of characters 1 in this string does not exceed $$$k$$$ (or both). For example, if $$$k = 3$$$, the strings 101010, 111, 0, 00000, 1111111000 are beautiful, and the strings 1111110000, 01010101 are not beautiful.

You are given a string $$$s$$$. You have to divide it into the minimum possible number of beautiful strings, i. e., find a sequence of strings $$$t_1, t_2, \dots, t_m$$$ such that every $$$t_i$$$ is beautiful, $$$t_1 + t_2 + \dots + t_m = s$$$ (where $$$+$$$ is the concatenation operator), and $$$m$$$ is minimum possible.

For every $$$k$$$ from $$$1$$$ to $$$|s|$$$, find the minimum possible number of strings such that $$$s$$$ can be divided into them (i. e. the minimum possible $$$m$$$ in the partition).

Input

The only line contains one string $$$s$$$ ($$$1 \le |s| \le 2 \cdot 10^5$$$). Each character of $$$s$$$ is either 0 or 1.

Output

Print $$$|s|$$$ integers. The $$$i$$$-th integer should be equal to the minimum number of strings in the partition of $$$s$$$, when $$$k = i$$$.

Examples

Input

00100010

Output

2 1 1 1 1 1 1 1

Input

1001011100

Output

3 2 2 2 1 1 1 1 1 1

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/18/2024 10:08:48 (i1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|