Spelling Bee

This commit is contained in:
2023-07-17 22:40:25 +02:00
parent ff54ec63ec
commit d5eca55da3

19
spellingbee.py Normal file
View File

@@ -0,0 +1,19 @@
letters = input()
n = int(input())
def check_word(word: str, letters: str) -> bool:
for letter in word:
if letter not in letters:
return False
return True
for _ in range(n):
word = input()
if 4 > len(word):
continue
if letters[0] not in word:
continue
if check_word(word, letters):
print(word)