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.

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

> planeCount("forms.txt")
6