[Python] python solution[Python] python solution
🕵️
The Secret Order
Week 3, 2026
//Paste your solution here if you want to share it publicly
alpha = "abcdefghijklmnopqrstuvwxyz"
def is_non_decreasing(word):
# Clean the word
word = word.strip().lower()
# Skip empty or words with non-letters
if not word or not word.isalpha():
return False
prev_index = -1 # before 'a'
for char in word:
idx = alpha.index(char)
if idx < prev_index:
return False
prev_index = idx # update to current position
return True
# ─── Read from file and print only matching words ────────────────
with open('data.txt', 'r', encoding='utf-8') as f:
for line in f:
words = line.split()
for word in words:
if is_non_decreasing(word):
print(word)