Spelling Bee
This commit is contained in:
19
spellingbee.py
Normal file
19
spellingbee.py
Normal 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)
|
||||
Reference in New Issue
Block a user