【例66.2】 朋友关系
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
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
20251129 C班作业(8)
- Status
- Done
- Problem
- 3
- Open Since
- 2025-11-29 0:00
- Deadline
- 2025-12-7 23:59
- Extension
- 24 hour(s)