[Python] python brute force approach[Python] python brute force approach

🕵️

The Secret Order

Week 3, 2026

# bmc's ideas below --- # checking if each word is in ALPHABETICAL ORDER or not. # since all of the BLUE words are, I decided to do the following: # ALSO, we see that 'A' is NOT VALID but 'AAA' is valid. Which made me think that maybe the minimum length is 2? # yeah and I did that and it worked, gamer god def is_valid(word): if len(word) < 2: return False word_lower = word.lower() sorted_version = ''.join(sorted(word_lower)) return sorted_version == word_lower with open('words.txt', 'r') as f: words = [line.strip().lower() for line in f if line.strip()] 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)}")