import re | |
def flip_hidden(question): | |
# Reverse only the text before '.rewsna' if present | |
match = re.search(r'^(.*)\.rewsna', question) | |
if match: | |
to_flip = match.group(1) | |
return to_flip[::-1].strip() | |
# Fallback: reverse the whole string | |
return question[::-1] |