Friendly Chongchong
InterviewTime limit1sMemory limit1024 MB
Given N meeting records in order, count how many people are dancing the rainbow dance after the last record, starting from ChongChong alone.
- Level
Easy3 of 10
- Topics
- Hash map, Simulation
- Solved
- No attempts yet
Problem

Chongchong got a chance to appear at the 2nd Gomgom Cup through his friend Gomgom!
Chongchong wants to win over the audience by showing off his special trick, the rainbow dance. The dance is so addictive that everyone who sees it ends up copying it.

records of people meeting each other are given in chronological order. (Chongchong is a rabbit, but for this problem, we assume he is a person.)
When a person who is not dancing the rainbow dance meets a person who is dancing it, the first person starts dancing it from the time of the meeting.
Before the records begin, Chongchong is the only one dancing the rainbow dance. Find how many people are dancing the rainbow dance after the last record!
Input
The first line contains the number of records . The next lines each contain one record. Line contains the names and of the two people in the -th meeting, separated by a space. and are strings of digits and English letters, up to 20 characters long, and they are different from each other.
Chongchong's name is ChongChong, and it appears in the records at least once. No two people share a name, and names are case-sensitive. (ChongChong and chongchong are different names.)
Output
Print the number of people dancing the rainbow dance after the last record.