Submit solution
Points:
5
Time limit:
2.0s
Memory limit:
128M
Author:
Problem types
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
items. To save space, he records the
-th item as a string,
, on his checklist. He has
upcoming assignments, the
-th of which requires
items to complete,
. If has all
required items, he can complete the
-th assignment. Otherwise, he flunks it. Help him determine how many assignments he can complete!
Constraints
In all subtasks,
where
denotes the length of string
Input Specification
The first line contains two space-separated integers, and
.
The next lines contain a single string,
. It is guaranteed that all the strings will be unique.
The next
sections contain a single integer
, followed by
lines each containing a single string,
.
Output Specification
Output a single integer on a single line, the answer to the problem.
Sample Input
3 4
chalk
cheese
charger
1
cheese
2
coins
cash
3
charger
chalk
caffeine
3
cheese
charger
cheese
Sample Output
2
Comments