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

24820번 - Spelling Bee 다국어

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

문제

The New York Times publishes a daily puzzle called the "Spelling Bee." In this puzzle, 7ドル$ letters are shown in a hexagonal arrangement of 6ドル$ letters around a center letter. The task is to come up with as many words as possible that

  • contain only letters that are displayed in the hexagon,
  • are at least of length 4ドル,ドル and
  • contain the center letter.

A letter may be used more than once, and not all letters need to be used.

After playing for a while, you get stuck, but then you remind yourself that the Linux distribution on your computer comes with a machine-readable file of 102ドル,305円$ dictionary words in /usr/share/dict/words!

You decide that even if you can't excel at the Spelling Bee you can still excel at programming, so you decide to write a program that finds all solutions to a Spelling Bee puzzle from your dictionary.

입력

The input consists of a single test case, which starts with a line with 7ドル$ distinct lowercase English letters. The first of these letters is the center letter. The next line contains an integer $n$ (1ドル \le n \le 102,305円$), the size of the dictionary. This line is followed by $n$ lines, each containing a dictionary word of $l$ lowercase English letters (1ドル \le l \le 24$).

출력

Output the word list matching the Spelling Bee puzzle in the order in which they appear in the dictionary. You are guaranteed that at least one dictionary entry will match.

제한

예제 입력 1

drulyag
27
dryad
duly
spelling
multiplexed
janna
lard
dryly
the
instances
gradual
gradually
dual
inimically
off
dullard
grad
equipage
gladly
mauritania
drug
a
drag
pickering
yard
daddy
on
lallygag

예제 출력 1

dryad
duly
lard
dryly
gradual
gradually
dual
dullard
grad
gladly
drug
drag
yard
daddy

힌트

출처

School > Virginia Tech High School Programming Contest > 2019 Virginia Tech High School Programming Contest C번

  • 문제를 만든 사람: Godmar Back
(追記) (追記ここまで)

출처

대학교 대회

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

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