B. 【例66.2】 朋友关系

    Type: Default 1000ms 64MiB

【例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 AA is a good friend of BB, then BB is also a good friend of AA. Friendship is not transitive: if AA is a good friend of BB, and BB is a good friend of CC, AA and CC 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 m+1m+1 lines.
The first line contains two integers nn and mm, representing the total number of students and the number of friendship pairs.
Lines 22 to m+1m+1 each describe a friendship pair, with two different student names separated by a single space. Each name consists only of lowercase letters, and 11 \leq name length 10\leq 10.

Output Format

A single integer, representing the maximum number of good friends any student has.

Sample

4 3
lucy lily
jam lily
jam peter
2

20251129 C班作业(8)

Not Claimed
Status
Done
Problem
3
Open Since
2025-11-29 0:00
Deadline
2025-12-7 23:59
Extension
24 hour(s)