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

32307번 - Injured Shoulder 다국어

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

문제

Dr. Orooji injured his right shoulder a few months ago and could type with only one hand for a while. For some reasons, Dr. O missed the space character (blank) often and two words would be next to each other without the space (i.e., words concatenated) and the spell-checker would complain.

Given the words in a dictionary and a word Dr. O has typed, determine the status of the typed word.

입력

The first input line contains an integer, n (2 ≤ n ≤ 20), indicating the number of words in the dictionary. Each of the next n input lines contains a dictionary word. Each word starts in column 1, contains at least one lowercase letter, at most 20 lowercase letters, and no other characters. Assume that the dictionary words are unique, i.e., no duplicates.

The next input line contains an integer, m (1 ≤ m ≤ 100), indicating the number of words Dr. O has typed. Each of the next m input lines contains a typed word. Each typed word starts in column 1, contains at least one lowercase letter, at most 40 lowercase letters, and no other characters.

출력

For each typed word, output one line as follows:

  • 1 – If the typed word is in the dictionary.
  • 2 – If the typed word is a concatenation of two words in the dictionary, i.e., Dr. O missed typing the space character (blank).
  • 0 (zero) – Otherwise.

Note that if a typed word is in the dictionary and it is also a concatenation of two words in the dictionary, output should be 1.

제한

예제 입력 1

7
this
is
a
test
th
the
e
12
is
test
isthis
the
th
ee
eee
thee
best
istestis
e
ea

예제 출력 1

1
1
2
1
1
2
0
2
0
0
1
2

힌트

출처

University > University of Central Florida > 2024 Local Programming Contest (Qualifying Round) 3번

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

출처

대학교 대회

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

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