#C8359. Maximum Connected Component in Stamp Album
Maximum Connected Component in Stamp Album
Maximum Connected Component in Stamp Album
Alex owns a stamp album with \(n\) available slots, and some pairs of these slots are directly connected. Two slots belong to the same group if there is a path of connected slots between them. In other words, the slots form an undirected graph, and Alex wants to know the size of the largest connected component.
If a slot is not connected to any other slot, then it forms a component of size \(1\). Your task is to determine the maximum number of stamps that can fit into a connected group in the album.
Note: The connections may include self-loops (i.e., a slot connected to itself), which should be treated as belonging to the same component without increasing the count.
inputFormat
The first line contains two integers \(n\) and \(m\) where \(n\) is the number of slots and \(m\) is the number of direct connections.
Each of the following \(m\) lines contains two space-separated integers \(u\) and \(v\) representing a connection between slot \(u\) and slot \(v\).
outputFormat
Output a single integer: the size of the largest connected component.
## sample5 4
1 2
2 3
4 5
3 5
5