-
-
Save rayansostenes/6ae81d6e51f00247b46e5d2186c08487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while True: | |
try: | |
num = int(input() or 0) | |
except EOFError: | |
num = 0 | |
if not num: | |
break | |
chars_saved = 0 | |
last_phone = None | |
phone_list = [input() for _ in range(num)] | |
phone_list.sort() | |
for phone in phone_list: | |
if last_phone is None: | |
last_phone = phone | |
continue | |
# compara as strings | |
for new_phone_char, last_phone_char in zip(phone, last_phone): | |
if new_phone_char == last_phone_char: | |
chars_saved += 1 | |
else: | |
break | |
last_phone = phone | |
print(chars_saved) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment