Problem Statement 

A polyline is a sequence of line segments such that each segment starts at the point where the previous segment ended.
If two polylines have a common point, we say that they belong to the same picture.
The common point does not have to be an endpoint of a line segment.
Your method will be given a String[] polylines. Concatenate the elements of polylines to get a spaceseparated list of polyline descriptions.
Each polyline description consists of one or more point descriptions, separated by single dashes (''). Each point is described by its two nonnegative integer coordinates,
separated by a comma (',').
Return the number of pictures in the union of all the given polylines.


Definition 
 Class:  PolylineUnion  Method:  countComponents  Parameters:  String[]  Returns:  int  Method signature:  int countComponents(String[] polylines)  (be sure your method is public) 




Notes 
  The point sequence that defines a polyline may contain the same point more than once, and even consecutive points are allowed to be equal. 
  A polyline may be just a single point. 

Constraints 
  polylines will have the format described in the problem statement. 
  polylines will contain between 1 and 50 elements, inclusive. 
  Each of the elements in polylines will contain between 0 and 50 characters, inclusive. 
  Each coordinate of each point specified in polylines will be between 0 and 10000, inclusive. 
  The point coordinates in polylines will not contain unnecessary leading zeros. 

Examples 
0)  
  Returns: 1  Two intersecting line segments form a single picture.



1)  
 {"0,010,5 5,015,510,105,5"} 
 Returns: 2  Two nonintersecting polylines.



2)  
  Returns: 2  Note that you first have to concatenate the elements of polylines and only then parse the resulting string. 


3)  
 {"10,010,19,29,38,4 ","8,29,210,3 ","12,211,29,1"} 
 Returns: 1  Together, these three polylines form a single picture. From a graph theoretical point of view, this picture can be seen as a tree with 11 vertices. (Ten of them are the given points and one is the intersection of 10,19,2 and 11,29,1.)



4)  
 {"0,010,00,0 20,08,020,0"} 
 Returns: 1  The union of these two polylines is the line segment 0,020,0. 


5)  
 {"1,1 2,2 3,3 4,4 3,34,4"} 
 Returns: 3  A single point is a special case of a polyline. 


6)  
 {"10,1020,10 20,1015,18 15,1810,10"} 
 Returns: 1  

7)  
 