#P382. 【例66.2】 朋友关系
【例66.2】 朋友关系
Description
Students should learn to make more good friends. Friendship is mutual: if is a good friend of , then is also a good friend of . Friendship is not transitive: if is a good friend of , and is a good friend of , and are not necessarily good friends. Given the friendship relations among some students in a primary school, write a program to count how many good friends the student with the most friends has.
Input Format
The input consists of lines.
The first line contains two integers and , representing the total number of students and the number of friendship pairs.
Lines to each describe a friendship pair, with two different student names separated by a single space. Each name consists only of lowercase letters, and name length .
Output Format
A single integer, representing the maximum number of good friends any student has.
Sample
4 3
lucy lily
jam lily
jam peter2
Related
In following homework: