#C11465. Exam Scoring
Exam Scoring
Exam Scoring
In this problem, you are given the correct answers for an exam and the answers of several students. Your task is to compute the score for each student by comparing their answers with the reference answers. For each question a student answers correctly (i.e. the student's answer matches the reference answer), they receive one point. Formally, if the number of questions is ( n ), and for a given student the answers are given by ( a_1, a_2, \dots, a_n ) and the reference answers are ( r_1, r_2, \dots, r_n ), then the student’s score is calculated as: [ \text{score} = \sum_{i=1}^{n} \mathbf{1}{{a_i = r_i}} ] where ( \mathbf{1}{{a_i = r_i}} ) is 1 if ( a_i = r_i ) and 0 otherwise.
inputFormat
The input is read from standard input (stdin) and has the following format:\
- The first line contains an integer ( n ) (the number of questions).\
- The second line contains ( n ) space-separated strings representing the correct (reference) answers.\
- The third line contains an integer ( m ) (the number of students).\
- The following ( m ) lines each contain ( n ) space-separated strings representing one student's answers.
outputFormat
Print a single line to standard output (stdout) containing ( m ) integers separated by a space. Each integer represents the score of a student, which is the number of answers that match the reference answers.## sample
5
A B C D E
3
A B C D F
A C B D E
A B C D E
4 3 5