import itertools
for test in range(int(input())):
a=input()
n=a.replace("=","")
l=list(n)
z = [(x[0], len(list(x[1]))) for x in itertools.groupby(l)]
print(max(z, key=lambda x:x[1])[1]+1)
The question is chefsign which was asked in july long.The above code satisfies some while rest are not fulfilled. Can anyone help?
Your code will fail if all “=” in test case… like…
1
==
because n would be empty string in that case… otherwise your algo is correct…
Thanks a lot again:)
1 Like