| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 1024 MB | 228 | 150 | 116 | 63.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
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.
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
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번