Logo
(追記) (追記ここまで)

26226번 - Autocomplete 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB134220.000%

문제

Two words are considered similar, if they are equal when compared in case-insensitive way, but in a case-sensitive comparison they differ in no more than $K$ positions.

A dictionary containing $W$ words as well as $Q$ query-words is given. For each query-word, print a single integer: the number of similar words in the dictionary.

입력

The first line of the input file contains an integer $K$ --- the maximum number of positions at which the words can differ by case (0 $\leq$ $K$ $\leq$ 5).

The second line contains an integer $W$ --- the number of words in the dictionary (1 $\leq$ $W$ $\leq$ 1,000円).

The following $W$ lines contain the dictionary, one word per line. Each line consists of small and capital Latin letters. All words are non-empty and are no longer than 2,000円 symbols.

The following line contains an integer $Q$ --- the number of queries (1 $\leq$ $Q$ $\leq$ 1,000円).

The next $Q$ lines contain queries, one word per line. Same as with the words in the dictionary, each query consists of capital and small Latin letters, all queries are non-empty and no longer than 2,000円 symbols each.

출력

For each of $Q$ queries from the input file print a single integer: the number of similar words in the dictionary. Answers to the queries must be printed in the same order as the queries are listed in the input.

제한

예제 입력 1

2
5
theword
TheWord
THEWORD
thewordandsomeletters
theword
4
theword
The
theword
TheWordAndSomeLetters

예제 출력 1

3
0
3
0

힌트

출처

Contest > Open Cup > 2016/2017 Season > Stage 2: Grand Prix of Eurasia 5번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /