def long_repeat(line)
a = line[0]
max_sub_str = 0
try:
for i in range(len(line)):
if line[i] == line[i+1]:
a += line[i+1]
else:
if len(a) > max_sub_str:
max_sub_str = len(a)
a = line[i]
except IndexError:
pass
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 :)
Created at: 2017/12/17 14:42; Updated at: 2019/11/13 04:29
The question is resolved.