영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
You are given a bit string of length n. Your task is to calculate for each k between 0 … n the number of non-empty substrings that contain exactly k ones.
For example, if the string is 101, there are:
- 1 substring that contains 0 ones: 0
- 4 substrings that contain 1 one: 01, 1, 1, 10
- 1 substring that contains 2 ones: 101
- 0 substrings that contain 3 ones
Input
The only input line contains a binary string of length n.
Output
Print n+1 values as specified above.
Constraints
- 1 ≤ n ≤ 2 · 10^5
예제
예제 1
101
1 4 1 0