This doesn't even make any sense, at least not according to the definition above.
If the input is:
5 girls have gathered 4 flowers each
girl 1: 1 2 3 4
girl 2: 5 6 9 6
girl 3: 1 1 1 1
girl 4: 2 4 4 3
girl 5: 7 7 7 7
|
According to the definition, a
girl is a set numbers. A
group is a set of
girls, where the intersection of one
girl with
another of the group is not the empty set. This definition isn't consistent with the example output you gave us, because either intersections of a girl with itself are allowed to form a group, which would sort of make the definition of a group pointless- because that would mean any girl can join any group -
or one-member groups aren't possible (because there aren't any other girls you could form intersections with). Of course you could also say that all girls that do not qualify for a group according to the first definition make a new group with only themselves as the member (useful, because that clears the question how a group is formed in the first place), however that doesn't explain why girl 2 is in a one person group AND in a 3 person group...
Unless I am misunderstanding your task, it doesn't really make any sense.