#K68567. Largest Connected Component in a Social Network

    ID: 32893 Type: Default 1000ms 256MiB

Largest Connected Component in a Social Network

Largest Connected Component in a Social Network

You are given a social network with (n) users labeled from 1 to (n) and (m) friendships. Each friendship is represented by a pair of distinct integers representing two connected users. Your task is to find the size of the largest connected component in this network. A connected component is a set of users where every user is reachable from any other user in the same set.

For example, if the network consists of 5 users and friendships (1,2), (2,3), and (4,5), then the largest connected component has a size of 3 (users 1, 2, and 3).

inputFormat

Input is given via standard input (stdin). The first line contains two integers (n) and (m) where (n) is the number of users and (m) is the number of friendships. The next (m) lines each contain two integers (u) and (v) indicating that user (u) and user (v) are friends.

outputFormat

Output via standard output (stdout) a single integer, which is the size of the largest connected component in the network.## sample

5 3
1 2
2 3
4 5
3

</p>