As you finish the last group’s customs declaration, you notice that you misread one word in the instructions.

You don’t need to identify the questions to which anyone answered “yes”; you need to identify the questions to which everyone answered “yes”!

Using the same example as above:

abc

a
b
c

ab
ac

a
a
a
a

b

This list represents answers from five groups:

In this example, the sum of these counts is 3 + 0 + 1 + 1 + 1 = 6.

Assignment

For each group, count the number of questions to which everyone answered “yes”. What is the sum of those counts? Determine this in the following way:

Example

In this interactive session we assume the text file forms.txt1 to be located in the current directory.

> group_count("abc")
3
> group_count("a b c")
0
> group_count("ab ac")
1
> group_count("a a a a")
1
> group_count("b")
1

> plane_count("forms.txt")
6