시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
3 초 | 128 MB | 2 | 2 | 2 | 100.000% |
A tree consists of a node and some (zero, one or two) subtrees connected to it. These subtrees are called children.
A specification of the tree is a sequence of digits. If the number of children in the tree is:
Each of the vertices in the tree must be painted either red or green or blue. However, we need to obey the following rules:
How many vertices may be painted green?
Write a program which:
The first and only line of the standard input consists of one word (no longer then 10000 characters), which is a specification of a tree.
Your program should write in the first and only line of the standard output exactly two integers separated by a single space, which respectively denote the maximal and the minimal number of vertices that may be painted green.
1122002010
5 2