Retaking a Course
Time limit1sMemory limit1024 MB
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, . The next 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.