All SolutionsAll Solutions
🎮
Game Chatroom
Week 10, 2026
Python All Character Check | Alexevi | Python Solutions
file = open("words.txt")
words = file.read().split('\n')
file.close()
for word in words:
if len(word) == 1: continue
b = True
for c in word:
if not c in ['a', 'b', 'c', 'd', 'e', 'f']:
b = False
break
if b: print(word)
Python - Simple validation | BMC | Python Solutions
'''
Original After Set Sorting Sorting Char freq.
b a d | a b d | a b d | 1 1 1
e f f a c e | a c e f | a c e e f f | 1 1 2 2
f e e d | d e f | d e e f | 1 2 1
c a b | a b c | a b c | 1 1 1
f a c e | a c e f | a c e f | 1 1 1 1
b e e f | b e f | b e e f | 1 2 1
d a d | a d | a d d | 1 2
c a f e | a c e f | a c e f | 1 1 1 1
a d d | a d | a d d | 1 2
a c c e d e | a c d e | a c c e e d | 1 2 2 1
b e a d | a b d e | a b d e | 1 1 1 1
f a c a d e | a c d e f | a c d e f | 1 1 1 1 1
f a d e | a d e f | a d e f | 1 1 1 1
d e c a d e | a c d e | a c d d e e | 1 1 2 2
a c e | a c e | a c e | 1 1 1
Minimum length here is 3. So all words.length >= 3
>> Words are only made up of `a-b-c-d-e-f`
and I think that must be it (it was)
'''
with open('words.txt', 'r') as f:
words = [line.strip().lower() for line in f if line.strip()]
def is_valid(word):
if len(word) < 2:
return False
for char in word.lower():
if char not in "abcdef": return False
return True
valid_words = []
for word in words:
if is_valid(word):
valid_words.append(word)
with open('valid_words.txt', 'w') as f:
for word in valid_words:
f.write(word + '\n')
print(f"Found {len(valid_words)} valid words out of {len(words)}")
Python - Simple validation | BMC | Python Solutions
'''
Original After Set Sorting Sorting Char freq.
b a d | a b d | a b d | 1 1 1
e f f a c e | a c e f | a c e e f f | 1 1 2 2
f e e d | d e f | d e e f | 1 2 1
c a b | a b c | a b c | 1 1 1
f a c e | a c e f | a c e f | 1 1 1 1
b e e f | b e f | b e e f | 1 2 1
d a d | a d | a d d | 1 2
c a f e | a c e f | a c e f | 1 1 1 1
a d d | a d | a d d | 1 2
a c c e d e | a c d e | a c c e e d | 1 2 2 1
b e a d | a b d e | a b d e | 1 1 1 1
f a c a d e | a c d e f | a c d e f | 1 1 1 1 1
f a d e | a d e f | a d e f | 1 1 1 1
d e c a d e | a c d e | a c d d e e | 1 1 2 2
a c e | a c e | a c e | 1 1 1
Minimum length here is 3. So all words.length >= 3
>> Words are only made up of `a-b-c-d-e-f`
and I think that must be it (it was)
'''
with open('words.txt', 'r') as f:
words = [line.strip().lower() for line in f if line.strip()]
def is_valid(word):
if len(word) < 2:
return False
for char in word.lower():
if char not in "abcdef": return False
return True
valid_words = []
for word in words:
if is_valid(word):
valid_words.append(word)
with open('valid_words.txt', 'w') as f:
for word in valid_words:
f.write(word + '\n')
print(f"Found {len(valid_words)} valid words out of {len(words)}")
Word by word, char by char, check in range | greenya | Odin Solutions
package main
import "core:fmt"
import "core:strings"
words_txt_bytes := #load("words.txt")
main :: proc () {
words_txt_trimmed := strings.trim(string(words_txt_bytes), "\n\r\t ")
words := strings.split_lines(words_txt_trimmed)
valid: int
next: for w in words {
if len(w) < 2 do continue
for c in w do if c < 'a' || c > 'f' do continue next
valid += 1
fmt.println(w)
}
fmt.println("--------------------------")
fmt.println("total words checked:", len(words))
fmt.println("total valid words :", valid)
}
Python read from file | THOMAS L | Python Solutions
//Paste your solution here if you want to share it publicl
with open("example.txt", "r") as f:
content = f.read()
words = content.split('\n')
for word in words:
if len(word) == 1:
continue
good = True
for c in word:
if c > 'f':
good = False
break
if good:
print(word)