• IndexError: string index out of range, long_repeat

 def long_repeat(line)
        a =     line[0]
        max_sub_str = 0
            for i in range(len(line)):
                if line[i] == line[i+1]:
                        a += line[i+1]
                    if len(a) > max_sub_str:
                        max_sub_str = len(a)
                    a = line[i]
        except IndexError:

        return max_sub_str

this code runs but I'm unable to check te result. Btw. I know it's wrong but my question is why it's not checking but giving me a indexError. Thank you :)