TEMA

Time Limit Problem

Alex70 preguntado 4 years ago

Ja tentei de outro modo é deu o mesmo erro

def decodeString(crypto, crib):
    lenghtCrib = len(crib)
    match = times = i = n = 0

    while len(crypto) >= len(crib):
        if crypto[i] == crib[n]:
            crypto = crypto[:0] + crypto[1:]
            n = 0
            i = 0
            match = 0
        else:
            match += 1
            n += 1
            i += 1
            if match == lenghtCrib:
                times += 1
                crypto = crypto[:0] + crypto[1:] 
                n = 0
                i = 0
                match = 0

    return times

if __name__ == "__main__":
    crypto = str(input())
    crib = str(input())
    print(int(decodeString(crypto,crib)))

Este tema aún no ha sido contestado. ¡Sé el primero!

Recuerda no enviar soluciones. Tu mensaje puede ser revisado por nuestros moderadores.