Skip to content

Instantly share code, notes, and snippets.

@zsrinivas
Created January 11, 2015 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsrinivas/e00b021db0e22d0461bd to your computer and use it in GitHub Desktop.
Save zsrinivas/e00b021db0e22d0461bd to your computer and use it in GitHub Desktop.
from itertools import groupby
def main():
def iterlength(x):
c = 0
for t in x:
c += 1
return c
while True:
try:
testcases = int(raw_input())
break
except ValueError:
pass
_ = 0
while _ < testcases:
s = raw_input().strip().split()
if not s:
continue
l = map(len, s)
m = float('-inf')
for x in groupby(l):
m = max(m, iterlength(x[1]))
print m
_ += 1
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment