#CCBCHHAI0000021. Bộ đếm phiếu 0, 1, 2, 9 (Count Votes Until Nine)
Bộ đếm phiếu 0, 1, 2, 9 (Count Votes Until Nine)
Count Votes Until Nine
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read integer vote codes in order. Count codes 0, 1 and 2; code 9 terminates the survey and is not counted. Ignore all other codes, including negative values and codes 3–8. Print the counts of 0, 1 and 2 before the first nine, in that order.
Input
A sequence of integers ending at the first 9, with no earlier 9 and no following values.
Output
Print three integers on one line, the counts for codes 0, 1 and 2, separated by single spaces.
Subtasks
- Subtask 1 (20%): At most 5 integers, each of absolute value at most 10.
- Subtask 2 (30%): At most 100 integers, each of absolute value at most 1000.
- Subtask 3 (50%): At most 100001 integers, each of absolute value at most 1000000.
Examples
Example 1
Input
0 1 7 2 0 9
Output
2 1 1
Explanation
Zero occurs twice, one and two once each; seven is ignored and nine only terminates input.
Example 2
Input
9
Output
0 0 0
Explanation
The first code is the terminator, leaving all three counters zero.