import sys, re
sys.stdout.reconfigure(encoding='utf-8')

# Strip emojis including variation selectors:
emoji_pattern = re.compile(r'[\U00010000-\U0010ffff\u2600-\u27ff\ufe00-\ufe0f]')

text1 = '🏛️ Kỳ Trân'
clean1 = emoji_pattern.sub('', text1).strip()
print(f"'{text1}' -> '{clean1}', words: {clean1.split()} ({len(clean1.split())})")

text2 = '⚔️ Ngoại Trang'
clean2 = emoji_pattern.sub('', text2).strip()
print(f"'{text2}' -> '{clean2}', words: {clean2.split()} ({len(clean2.split())})")
