• What's wrong with my code?

Question related to mission The Most Wanted Letter


In my editor, the code runs fine and passes all the assertion checks. When I try to do it in checkio's editor, it runs veeeeeery slowly, before giving me an error. The example it fails on is checkio("aaaaaaaaaaaaa") with many more a's. I'm unable to replicate the error on my end. Any ideas?

def checkio(text: str) -> str:

t2 = text.lower()
v2 = []
numbers = []
l1 = []

for letter in t2:
    if letter.isalpha() == False:
        number = ord(letter) - 96

for i in t2:
    if i.isalpha():


    v1 = t2[v2.index(max(v2))]

if v2.count(max(v2))>1:
    for n in numbers:
        if numbers.count(n) ==max(v2) and n not in l1:
            n1 = min(l1)
            v1 = chr(n1+96)

        elif max(v2) == min(v2):
            v1 = chr(min(numbers)+96)

return v1