#C11379. Unique Items in Gift Baskets

    ID: 40688 Type: Default 1000ms 256MiB

Unique Items in Gift Baskets

Unique Items in Gift Baskets

In this problem, you are given a number of gift baskets along with the list of items in each basket. Your task is to determine the total number of unique items across all baskets. Each basket's items are given in a single line, where the first number indicates the total items in that basket, followed by the items themselves.

Formally, if there are (T) baskets and each basket (i) contains a list of items (B_i), you are required to compute the size of the set (\bigcup_{i=1}^{T}{B_i}).

inputFormat

The input is given via standard input (stdin). The first line contains an integer (T), the number of gift baskets. Each of the following (T) lines describes a basket. Each line begins with an integer representing the number of items in that basket, followed by the list of items separated by spaces.

outputFormat

The output is a single integer printed to standard output (stdout) representing the total number of unique items across all baskets.## sample

3
4 apple banana orange mango
3 banana grape apple
2 pear mango
6