lundi 29 juin 2015

Finding the length of longest repeating?


I have tried plenty of different methods to achieve this, and I don't know what I'm doing wrong.

reps=[]
len_charac=0
def longest_charac(strng)
    for i in range(len(strng)):
        if strng[i] == strng[i+1]:
            if strng[i] in reps:
                reps.append(strng[i])
                len_charac=len(reps)
    return len_charac


Aucun commentaire:

Enregistrer un commentaire