Similar String Groups

Implement solve for Similar String Groups. Return the required output for the provided arguments.

Examples
Input: ["tars","rats","arts","star"]
Output: 2
Hints

Similar String Groups

Implement `solve` for **Similar String Groups**. Return the required output for the provided arguments.