Problem1425--Counting Leaves

1425: Counting Leaves

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 0  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.

Input

The input consists of several test cases, each starts with a line containing 0

Output

The input consists of several test cases, each starts with a line containing 0

Sample Input Copy

1 0
7 4
01 2 02 03
06 1 07
02 2 04 05
03 1 06
0 0

Sample Output Copy

1
0 0 2 1

Source/Category