UVa 459 - Graph Connectivity

459 - Graph Connectivity
459 - Graph Connectivity

Explanation
In this problem you have to print the number of Connected Components in a given graph. You can use Breadth-First Search or Depth-First Search algorithms in order to archieve this number.

One can also use Union-sets to find the number of connected components in the graph.

Input
1

E AB CE DB EC

Output
2