#K80317. Counting Genre Mismatches

    ID: 35504 Type: Default 1000ms 256MiB

Counting Genre Mismatches

Counting Genre Mismatches

You are given two lists representing the library's inventory check and the correct genre labels for a set of books. Each list contains n entries. The first list provides the book identifier and its genre as noted during the inventory, while the second list provides the corresponding correct genre for each book.

Your task is to count how many books have been labeled correctly and how many have been mislabeled. Formally, if we denote the inventory check as \( (B_i, G_i) \) and the correct labels as \( (B_i, G'_i) \), then you need to compute:

[ \text{correct} = \sum_{i=1}^{n} \mathbf{1}_{{G_i = G'_i}}, \quad \text{mismatched} = n - \text{correct} ]

Assume that the book IDs are unique and appear in the same order in both lists.

inputFormat

The input is read from stdin and has the following format:

  • First line: a single integer \(n\) representing the number of books.
  • The next \(n\) lines: each line contains two strings separated by space, representing a book ID and its genre label from the inventory check.
  • The following \(n\) lines: each line contains two strings separated by space, representing a book ID and its correct genre.

outputFormat

Output to stdout two space-separated integers. The first integer is the count of correctly labeled books, and the second integer is the count of mislabeled books.

## sample
4
bk1 Fiction
bk2 Science
bk3 Romance
bk4 Fiction
bk1 Literature
bk2 Science
bk3 Thriller
bk4 Fiction
2 2