Under construction

Still being built. Things may change

Retaking a Course

Time limit1sMemory limit1024 MB

Summary
Given a course code and a list of course codes, count how many share the same first 5 characters as the given code.
Level

Easy1 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Kookmin University uses a 'course code' whenever it needs to tell courses apart, for example during course registration or grade lookup. A course code has 10 characters. The 7th character is an uppercase English letter or a digit, the 8th character is a hyphen (-), and the remaining characters are digits.

You need to retake courses to recover poor grades. To retake a course, you must take a course whose code matches the first 5 characters of the course you want to retake. Given the code of the course you want to retake and the list of courses available for registration, print how many courses count as retakes.

Input

The first line contains the code of the course to retake. The second line contains the number of courses available for registration, NN. (1≤N≤16)(1\le N\le 16) The next NN lines each contain the code of a course available for registration. All course codes in the input are distinct.

Output

Print the number of courses that count as retakes.

Examples1

  1. Example 1

    Input
    000200D-18
    5
    000200D-18
    000200C-01
    000210D-18
    660820A-01
    0002000-00
    
    Expected output
    3