In the alabaster quarry of Whitestone, Zoya the factor keeps careful count of the canals. assign crews to the morning shifts, every figure matters. Task: An undirected graph has n nodes and m edges. Print the number of connected components. Input format: First line: n and m. Next m lines: u v. Output format: Print the component count. Constraints: 1 <= n <= 1275; 0 <= m <= 2550; 1 <= u,v <= n.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 1275; 0 <= m <= 2550; 1 <= u,v <= n.
