# Set unions and intersections

Sets in Python are similar to sets in math in many senses. They are defined in the say way - with curly brackets. One can perform set union, intersection, or subtraction on sets. Intersection of a set X and Y can be done with

`&`

in Python. Union of set X and Y can be done with `|`

. And subtraction can be done with a simple `-`

operator:```
x = {3, 12, 5, 13}
y = {14, 15, 6, 3}
print(x, y) # {5, 3, 12, 13} {3, 15, 6, 14}
print(x & y) # {3}
print(x | y) # {3, 5, 6, 12, 13, 14, 15}
print(x - y) # {13, 12, 5}
```

- The intersection of two sets includes all the elements that are present in both sets. So, in Python, it’s denoted as an “and”
`&`

operator (elements Both in A and B).

- The union of two sets includes all the elements of both sets. So, in Python, it’s denoted as an “or”
`|`

operator (elements either in A or B).

- The subtraction of two sets includes all the elements that are present in set A but not present in B. So, in Python, it’s denoted as a “subtraction”
`-`

operator (elements in A but not in B).

Challenge

Imagine that you are a teacher in a class where every group creates several presentations during a year for different topics. There are

`n`

groups of students and each group creates one or more presentations during a year. You are interested in 2 numbers. How many different topics have been covered during a year and how many topics have been presented by ALL the groups.The first line of the input contains a single integer

`n`

. The next `n`

lines contain the topics that each group presented separated by a comma and a space `, `

.The program should print two numbers separated by a space. The first number should indicate the number of topics presented in total and the second number should indicate how many topics have been covered by every group in the class.

Input | Output |

4
Neural Networks, Deep Learning, Machine Learning, AI
AI, Data Science, Sports Analytics, Deep Learning
Deep Learning, AI, Automation of jobs with AI
AI, Scientific thinking, Recent advances in NLP, Deep Learning | 9 2 |

1
Python, Django, Flask, AI, Backend | 5 5 |

**Explanation**:

- There are 9 unique topics covered: Deep Learning, Machine Learning, Neural Networks, Data Science, Sports Analytics, Scientific thinking, Automation of jobs with AI, Recent advances in NLP, AI

- There are 2 topics covered by all the groups: Deep Learning, AI

#### Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB