Skip to content

Instantly share code, notes, and snippets.

@mikl745
Created April 4, 2017 18:59
Show Gist options
  • Save mikl745/8ca33113b80e36d5c77ff774928498e0 to your computer and use it in GitHub Desktop.
Save mikl745/8ca33113b80e36d5c77ff774928498e0 to your computer and use it in GitHub Desktop.
w = int(input())
a = [list(map(int, input().split())) for x in range(w)]
y = 0
j = []
for i in range(w):
if i + 1 == w:
if a[i - 1] == a[i]:
y = y + 1
a.append(y)
else:
j.append(y)
else:
if a[i] == a[i + 1]:
y = y + 1
elif a[i] != a[i+1]:
j.append((y + 1,a[i]))
y = 0
t = max(j)
print(t[0],t[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment