Light Mode
Dark Mode
repeat long

Hey guys,

first of all my code:

def func(text):
    counter = 0
    text_l = text.lower()

    for i in range(len(text_l) - 1):
        print(text_l[i], text_l[i+1])
        if text_l[i] == text_l[i+1]:
            counter += 1

    return counter

Now this returns the number of equal following chars in the whole string, but the task wants to return the longest substring. How can I divide text in suitable substrings?

Thanks for your help ...

Created: Aug. 13, 2017, 12:35 p.m.
Updated: April 7, 2018, 8:30 a.m.
0
5
User avatar
bleazor