GO Solution For UVa 10608 - Friends. In this post we will see how we can solve this challenge in GoLang for UVa Online Judge.

Problem Description

There is a town with N citizens. It is known that some pairs of people are friends. According to the famous saying that “The friends of my friends are my friends, too” it follows that if A and B are friends and B and C are friends then A and C are friends, too.

Your task is to count how many people

...

You can find the full details of the problem Friends at UVa Online Judge

Sample Input

2
3 2
1 2
2 3
10 12
1 2
3 1
3 4
5 4
3 5
4 6
5 2
2 1
7 1
1 2
9 10
8 9

Sample Output

3
7

Solution: Please check the main.go snippet for the solution.

Solution originally posted at: Github by @codingsince1985