There are $n$ houses along the road where Anya lives, each one is painted in one of $k$ possible colors.

Anya likes walking along this road, but she doesn't like when two adjacent houses at the road have the same color. She wants to select a long segment of the road such that no two adjacent houses have the same color.

Help Anya find the longest segment with this property.


-----Input-----

The first line contains two integers $n$ and $k$ — the number of houses and the number of colors ($1 \le n \le 100\,000$, $1 \le k \le 100\,000$).

The next line contains $n$ integers $a_1, a_2, \ldots, a_n$ — the colors of the houses along the road ($1 \le a_i \le k$).


-----Output-----

Output a single integer — the maximum number of houses on the road segment having no two adjacent houses of the same color.


-----Example-----
Input
8 3
1 2 3 3 2 1 2 2

Output
4



-----Note-----

In the example, the longest segment without neighboring houses of the same color is from the house 4 to the house 7. The colors of the houses are $[3, 2, 1, 2]$ and its length is 4 houses.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
mx = 0
temp = 1
for i in range(1, n):
	if a[i] != a[i - 1]:
		temp += 1
	else:
		if temp > mx:
			mx = temp
		temp = 1
print(max(temp, mx))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
(ans, tp) = (0, [])
for i in range(n - 1):
	if l[i] != l[i + 1]:
		ans += 1
	else:
		tp.append(ans)
		ans = 0
tp.append(ans)
print(max(tp) + 1)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
x = 1
y = 1
for i in range(0, n - 1):
	if a[i] != a[i + 1]:
		x += 1
	elif y < x:
		y = x
		x = 1
	else:
		x = 1
print(max(x, y))


(a, b) = map(int, input().split())
s = input().split()
(m, c) = (1, 1)
for i in range(0, len(s) - 1):
	if s[i] != s[i + 1]:
		m = m + 1
		if m > c:
			c = m
	else:
		m = 1
print(c)


(n, k) = map(int, input().split())
lst = list(map(int, input().split()))
c = 0
l = [1]
i = 0
for i in range(0, len(lst) - 1):
	if lst[i] == lst[i + 1]:
		c = c + 1
		l.append(c)
		c = 0
	else:
		c = c + 1
if lst[-1] != lst[i]:
	c = c + 1
	l.append(c)
print(max(l))


(n, k) = list(map(int, input().split()))
cl = list(map(int, input().split()))
t = 1
mx = 0
for i in range(n - 1):
	if cl[i] != cl[i + 1]:
		t += 1
	else:
		if t > mx:
			mx = t
		t = 1
if t > mx:
	mx = t
print(mx)


(n, k) = map(int, input().split())
line = [int(x) for x in input().split(' ')]
line.append(line[-1])
maxs = []
last = line[0]
count = 1
for i in range(1, n + 1):
	if line[i] != last:
		count += 1
	else:
		maxs.append(count)
		count = 1
	last = line[i]
if maxs == []:
	print(1)
else:
	print(max(maxs))


(a, b) = map(int, input().split(' '))
d = []
for i in input().split(' '):
	d.append(int(i))
c = []
n = 1
t = 0
if a == 1:
	print(1)
elif a == 2:
	if d[0] == d[1]:
		print(1)
	else:
		print(2)
else:
	for i in range(1, a):
		if d[i - 1] != d[i]:
			n += 1
			if i == a - 1:
				c.append(int(n))
		else:
			c.append(int(n))
			n = 1
	if len(c) == 0:
		t = a
	else:
		t = max(c)
	print(t)


nk = input().split(' ')
n = int(nk[0])
k = int(nk[1])
ar = input().split(' ')
ar = list(filter(lambda x: x != '', ar))
c = 1
mx = 1
i = 0
while i < n - 1:
	if ar[i] != ar[i + 1]:
		c += 1
	else:
		if c > mx:
			mx = c
		c = 1
	i += 1
if c > mx:
	mx = c
print(mx)


count = 1
list_distance = list()
hou_col = input()
n = int(hou_col[0:hou_col.find(' ')])
c = int(hou_col[hou_col.find(' ') + 1:])
colors = input()
colour_list = colors.split()
for i in range(0, n - 1):
	if colour_list[i] != colour_list[i + 1]:
		count += 1
	else:
		list_distance.append(count)
		count = 1
list_distance.append(count)
list_distance.sort(reverse=True)
print(list_distance[0])


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	(n, k) = LI()
	l = LI()
	ans = 0
	a = -inf
	tmp_ans = 0
	for x in l:
		if x != a:
			tmp_ans += 1
		else:
			ans = max(ans, tmp_ans)
			tmp_ans = 1
		a = x
	ans = max(ans, tmp_ans)
	return ans
print(main())


def pleasant_walk():
	houses = input()
	array = list(map(int, input().split()))
	best_atm = 0
	best_sofar = 0
	for i in range(1, len(array)):
		if array[i] != array[i - 1]:
			best_atm += 1
		else:
			if best_atm > best_sofar:
				best_sofar = best_atm
			best_atm = 0
	if best_atm > best_sofar:
		best_sofar = best_atm
	return best_sofar + 1
A = pleasant_walk()
print(A)


(x, y) = input().split()
(x, y) = (int(x), int(y))
arr = [int(x) for x in input().split()]
soma = 0
somasofar = 0
for i in range(x - 1):
	if arr[i] == arr[i + 1]:
		if somasofar >= soma:
			soma = somasofar
		somasofar = 0
	else:
		somasofar += 1
if somasofar >= soma:
	soma = somasofar
print(soma + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = []
s = 1
for i in range(1, n):
	if a[i] == a[i - 1]:
		ans.append(s)
		s = 1
	else:
		s += 1
ans.append(s)
print(max(ans))


(n, k) = list(map(int, input().split()))
houses = list(map(int, input().split()))
stack = []
maxi = 0
for h in houses:
	if stack != []:
		if h == stack[-1]:
			maxi = max(maxi, len(stack))
			stack = [h]
		else:
			stack.append(h)
	else:
		stack.append(h)
		maxi = max(maxi, 1)
maxi = max(maxi, len(stack))
print(maxi)


(n, k) = list(map(int, input().split()))
l = list(map(int, input().split()))
x = [l[0]]
z = 0
for i in range(1, n):
	if l[i] != l[i - 1]:
		x.append(l[i])
	else:
		if z < len(x):
			z = len(x)
		x.clear()
		x.append(l[i])
print(max(z, len(x)))


dom_color = [int(x) for x in input().split(' ')]
dom = [int(x) for x in input().split(' ')]
max1 = 1
max2 = 1
for i in range(dom_color[0] - 1):
	if dom[i] != dom[i + 1]:
		max2 += 1
	if dom[i] == dom[i + 1]:
		if max2 > max1:
			max1 = max2
		max2 = 1
if max2 > max1:
	max1 = max2
print(max1)


(t, m) = map(int, input().split())
arr = list(map(int, input().split()))
counter = 0
cache = 0
maxi = 0
for i in range(t):
	if i == 0:
		cache = arr[i]
		counter = counter + 1
	elif cache != arr[i]:
		counter = counter + 1
		cache = arr[i]
	else:
		counter = 1
	if maxi < counter:
		maxi = counter
print(maxi)


input()
a = [int(x) for x in input().split(' ')]
m = 1
current = 1
for i in range(1, len(a)):
	if a[i - 1] == a[i]:
		m = max(m, current)
		current = 0
	current += 1
if current > 0:
	m = max(m, current)
print(m)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
count = 0
for i in range(1, n):
	if a[i] != a[i - 1]:
		count += 1
	if count > ans:
		ans = count
	if a[i] == a[i - 1]:
		count = 0
print(ans + 1)


c = input().split()
n = int(c[0])
m = int(c[1])
l2 = []
l3 = []
l = [int(i) for i in input().split()]
l2 = [l[0]]
x = 0
for i in l[1:]:
	if i != l2[-1]:
		l2.append(i)
	else:
		x = 1
		l3.append(len(l2))
		l2 = [l[l.index(i)]]
l3.append(len(l2))
if x == 0:
	print(len(l))
else:
	print(max(l3))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = 1
mc = 0
for i in range(1, n):
	if a[i] != a[i - 1]:
		c += 1
	else:
		mc = max(mc, c)
		c = 1
mc = max(mc, c)
print(mc)


x = input()
x = x.split()
n = int(x[0])
k = int(x[1])
x = input()
x = list(map(int, x.split()))
y = []
ct = 1
act = []
y.append(x[0])
for i in range(1, len(x)):
	if x[i] != y[ct - 1]:
		ct += 1
		y.append(x[i])
	else:
		y.clear()
		act.append(ct)
		ct = 1
		y.append(x[i])
act.append(ct)
print(max(act))


T = 1
for _ in range(T):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	count = 1
	maxSoFar = 1
	for i in range(1, n):
		if a[i - 1] != a[i]:
			count += 1
			maxSoFar = max(maxSoFar, count)
		else:
			count = 1
	print(maxSoFar)


n = input()
s = input().split()
a = 1
maxa = 1
for q in range(len(s) - 1):
	if s[q] == s[q + 1]:
		if maxa < a:
			maxa = a
		a = 1
	else:
		a += 1
if maxa < a:
	maxa = a
print(maxa)


import sys
from io import StringIO
from atexit import register
BUFFER = StringIO(sys.stdin.read())

def input():
	return BUFFER.readline().rstrip()
sys.stdout = StringIO()
register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))

def Rdi():
	return int(input())

def Rd(f=int):
	return [f(x) for x in input().split()]

def PrintF(arr):
	return ' '.join(('{:.10f}'.format(x) for x in arr))

def Debug(x):
	print('\x1b[0;31m{}\x1b[0m'.format(x), file=sys.stderr)
(n, k) = Rd()
A = Rd()
cur = 0
prev = 0
ans = 0
for h in A:
	if h == prev:
		cur = 1
	else:
		cur += 1
	prev = h
	ans = max(ans, cur)
print(ans)


test = input()
temp = input().split(' ')
max = 0
counter = 0
for i in range(len(temp) - 1):
	if temp[i] == temp[i + 1]:
		if counter > max:
			max = counter
		counter = 0
	else:
		counter = counter + 1
if counter > max:
	max = counter
print(max + 1)


(n, k) = map(int, input().split())
li = list(map(int, input().split()))
li1 = []
c = 0
for i in range(n - 1):
	if li[i] != li[i + 1]:
		c = c + 1
	else:
		li1.append(c)
		c = 0
	li1.append(c)
if len(li1) == 0:
	print(n)
else:
	print(max(li1) + 1)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
Sum = 0
i = 1
while i < n:
	curr_sum = 0
	while i < n and a[i] != a[i - 1]:
		curr_sum += 1
		i += 1
	if curr_sum > Sum:
		Sum = curr_sum
	i += 1
print(Sum + 1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a.append(a[-1])
cnt = 1
ans = 0
for i in range(n):
	if not a[i] == a[i + 1]:
		cnt += 1
	else:
		ans = max(ans, cnt)
		cnt = 1
print(ans)


(n, k) = map(int, input().split())
(o, D) = (0, [])
a = [int(z) for z in input().split()]
a += [a[-1]] * 2
for i in range(n + 1):
	if a[i] == a[i + 1]:
		D += [o]
		o = 0
	else:
		o += 1
print(max(D) + 1)


(n, k) = map(int, input().split())
c = list(map(int, input().split()))
i = 0
k = []
z = []
f = 0
l = 0
if n == 1:
	z = [1]
while i < n - 1:
	if c[i] != c[i + 1]:
		k.append(c[i])
	if c[i] == c[i + 1] or i + 2 == n:
		k.append(c[i])
		if len(z) < len(k):
			z = k[:]
		k = []
	i += 1
print(len(z))


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
(x, y, z) = (1, 0, 0)
t = l[0]
if len(l) == 1:
	print(1)
else:
	for i in l[1:]:
		if i != t:
			x += 1
			t = i
			z = x
		else:
			if x > y:
				y = x
			x = 1
	print(max(z, y))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
sames = []
for i in range(n - 1):
	if a[i] == a[i + 1]:
		sames.append(i)
sames = [-1] + sames + [n - 1]
best = 0
for i in range(len(sames) - 1):
	best = max(best, sames[i + 1] - sames[i])
print(best)


(N, K) = map(int, input().split())
a = input().split()
m = 0
k = 1
for i in range(1, len(a)):
	if a[i - 1] != a[i]:
		k += 1
	else:
		if k > m:
			m = k
		k = 1
if k > m:
	print(k)
else:
	print(m)


(n, k) = [int(b) for b in input().split()]
a = input().split()
(q, mas) = (1, [1])
if n == 1:
	print(1)
elif n == 2:
	if a[0] != a[1]:
		print(2)
	else:
		print(1)
else:
	for i in range(1, len(a) - 1):
		if a[i] != a[i - 1] and a[i] != a[i + 1]:
			q += 1
		else:
			if a[i] != a[i - 1]:
				q += 1
			mas.append(q)
			q = 1
	mas.append(q + 1)
	print(max(mas))


(n, k) = [int(s) for s in input().split(' ')]
houses = [int(s) for s in input().split(' ')]
maxN = 1
tmpN = 1
for i in range(n - 1):
	tmpN += int(houses[i] != houses[i + 1])
	maxN = max(maxN, tmpN)
	tmpN = int(houses[i] != houses[i + 1]) * tmpN + int(houses[i] == houses[i + 1])
print(maxN)


def ii():
	return int(input())

def mi():
	return list(map(int, input().split()))

def li():
	return list(mi())
(n, k) = mi()
a = li()
c = p = 0
ans = 1
for ai in a:
	if ai == p:
		c = 1
	else:
		c += 1
		ans = max(ans, c)
	p = ai
print(ans)


def nice_walk(lst):
	result = 0
	count = 0
	for i in range(len(lst)):
		if i + 1 < len(lst):
			if lst[i + 1] != lst[i]:
				count += 1
			else:
				count = 0
		result = max(result, count)
	return result + 1
(n, k) = [int(j) for j in input().split()]
b = [int(x) for x in input().split()]
print(nice_walk(b))


(n, k) = list(map(int, input().split()))
arr = list(map(int, input().split()))
length = 1
maxSeq = 1
adj = arr[0]
if len(arr) > 1:
	for i in range(1, len(arr)):
		if adj == arr[i]:
			maxSeq = length if length > maxSeq else maxSeq
			length = 1
		else:
			adj = arr[i]
			length += 1
maxSeq = length if length > maxSeq else maxSeq
print(maxSeq)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
last = ''
m = 0
s = 0
for i in a:
	if i == last:
		s = 1
	else:
		s += 1
	last = i
	if s > m:
		m = s
print(m)


(n, k) = map(int, input().split())
r = input().split()
(m, c) = (1, 1)
for i in range(1, len(r)):
	if r[i] != r[i - 1]:
		m += 1
		if m >= c:
			c = m
	else:
		m = 1
print(c)


(a, b) = input().split()
k = input().split()
k = [int(i) for i in k]
sum = 1
max = 1
current = k[0]
if len(k) > 1:
	for i in range(1, len(k)):
		if current != k[i]:
			sum += 1
			current = k[i]
		else:
			max = max if max > sum else sum
			sum = 1
max = max if max > sum else sum
print(max)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
l.append(l[-1])
c = 1
ma = 1
for i in range(n):
	if l[i] == l[i + 1]:
		ma = max(ma, c)
		c = 1
	else:
		c += 1
print(ma)


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
st = 0
end = 0
res = 1
for i in range(1, n):
	if a[i] != a[i - 1]:
		end += 1
	else:
		res = max(res, end - st + 1)
		st = i
		end = i
if end == n - 1:
	res = max(res, end - st + 1)
print(res)


n = input()
a = input()
a = a.split()
for pos in range(len(a)):
	a[pos] = int(a[pos])
Sol = []
max = 0
for idx in range(len(a)):
	if idx < len(a) - 1:
		if a[idx] != a[idx + 1]:
			Sol.append(a[idx])
		else:
			Sol.append(a[idx])
			idx = idx + 1
			if max < len(Sol):
				max = len(Sol)
			Sol.clear()
	else:
		Sol.append(a[idx])
		if max < len(Sol):
			max = len(Sol)
		Sol.clear()
print(max)


import sys

def fi():
	return sys.stdin.readline()
(n, k) = map(int, fi().split())
l = list(map(int, fi().split()))
c = 0
max1 = 0
p = 0
if n == 1:
	print(1)
else:
	while p < n - 1:
		if l[p + 1] != l[p]:
			c += 1
		else:
			c += 1
			max1 = max(c, max1)
			c = 0
		p += 1
	if l[n - 1] != l[n - 2]:
		c += 1
	max1 = max(max1, c)
	print(max1)


(n, k) = list(map(int, input().split()))
x = list(map(int, input().split()))
l = r = ln = 0
while r < n:
	if r > 0 and x[r] == x[r - 1]:
		l = r
	ln = max(ln, r - l + 1)
	r += 1
print(ln)


(n, m) = input().split()
l = list(map(int, input().split()))
cnt = 0
ma = 0
for x in range(1, len(l)):
	if l[x] == l[x - 1]:
		if cnt > ma:
			ma = cnt
		cnt = 0
	else:
		cnt += 1
if cnt > ma:
	ma = cnt
print(ma + 1)


(n, k) = map(int, input().split())
ans = 1
z = 1
l = list(map(int, input().split()))
for i in range(n - 1):
	if l[i] != l[i + 1]:
		ans += 1
		z = max(z, ans)
	else:
		ans = 1
print(z)


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
ans = cnt = 1
for i in range(n - 1):
	if a[i] != a[i + 1]:
		cnt += 1
	else:
		cnt = 1
	ans = max(cnt, ans)
print(ans)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
b = list([x != y for (x, y) in zip(a, a[1:])])
longest = 0
cur = 0
for t in b:
	if t:
		cur += 1
	else:
		cur = 0
	longest = max(longest, cur)
print(longest + 1)


(n, m) = map(int, input().split())
x = -1
y = 0
ans = 0
for i in map(int, input().split()):
	if i == x:
		y = 0
	y += 1
	x = i
	ans = max(ans, y)
print(ans)


def iter_from_input():
	return map(int, input().split())

def solve(n, k, colors):
	colors = iter(colors)
	previous_color = next(colors)
	current_length = 1
	max_length = current_length
	for color in colors:
		if color == previous_color:
			max_length = max(max_length, current_length)
			current_length = 1
		else:
			current_length += 1
		previous_color = color
	max_length = max(max_length, current_length)
	return max_length

def test():
	assert solve(4, 1, (1, 1, 1, 1)) == 1
	assert solve(4, 2, (1, 1, 1, 2)) == 2
	assert solve(4, 2, (2, 1, 2, 1)) == 4

def main():
	(n, k) = iter_from_input()
	colors = list(iter_from_input())
	result = solve(n, k, colors)
	print(result)
main()


j = input()
l = input().split()
start = 0
ma = 1
count = 0
for i in range(len(l)):
	if int(l[i]) == int(l[i - 1]):
		if ma < count:
			ma = count
		count = 1
	else:
		count += 1
print(max(ma, count))


(n, k) = map(int, input().split())
house = list(map(int, input().split()))
i = 0
sum = 0
while i < len(house) - 1:
	p = i
	while house[i] != house[i + 1]:
		i += 1
		if i == len(house) - 1:
			break
	len1 = i - p
	sum = max(len1, sum)
	i += 1
print(sum + 1)


(a, b) = list(map(int, input().split()))
c = list(map(int, input().split()))
e = []
c = [c[0]] + c + [c[-1]]
for i in range(1, a + 2):
	if c[i] == c[i - 1]:
		e += [i]
print(max(list((e[i] - e[i - 1] for i in range(1, len(e))))))


(n, k) = map(int, input().split())
Max = 0
m = 1
H = list(map(int, input().split()))
for i in range(n - 1):
	if H[i] != H[i + 1]:
		m += 1
	else:
		if m > Max:
			Max = m
		m = 1
if m > Max:
	Max = m
print(Max)


_ = list(map(int, input().split()))
__ = list(map(int, input().split()))
___ = 1
____ = 1
for _1 in range(1, _[0]):
	if __[_1] != __[_1 - 1]:
		___ += 1
	else:
		___ += 1
		___ = 1
	if ___ > ____:
		____ = ___
print(____)


stats = input().split()
homes = input().split()
l = []
results = []
temporary = [homes.pop(0)]
results = []
while True:
	if len(homes) == 0:
		results.append(len(temporary))
		break
	current = homes.pop(0)
	if current == temporary[-1]:
		results.append(len(temporary))
		temporary = [current]
	else:
		temporary.append(current)
print(max(results))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
max = 1
count = 1
for i in range(len(a) - 1):
	if a[i] != a[i + 1]:
		count += 1
		if max < count:
			max = count
	else:
		count = 1
print(max)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
p = 1
max_p = 1
for i in range(1, n):
	if a[i] != a[i - 1]:
		p += 1
	else:
		if p > max_p:
			max_p = p
		p = 1
max_p = max(p, max_p)
print(max_p)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
(n, k) = f()
l = il()
mx = 1
c = 1
for i in range(1, n):
	if l[i - 1] != l[i]:
		c += 1
	else:
		mx = max(mx, c)
		c = 1
print(max(mx, c))


(n, k) = map(int, input().split())
c = list(map(int, input().split()))
m = 1
z = 0
e = 0
while e < n:
	while e + 1 < n and c[e] != c[e + 1]:
		e += 1
	m = max(m, e - z + 1)
	while e + 1 < n and c[e] == c[e + 1]:
		e += 1
	z = e
	e += 1
print(m)


(n, k) = [int(j) for j in input().split()]
nums = [int(j) for j in input().split()]

def check(p):
	if p - 1 >= 0:
		if nums[p] == nums[p - 1]:
			return False
	return True
(output, p) = (0, 0)
while p < n:
	(size, sp) = (1, p + 1)
	while sp < n:
		if check(sp) == True:
			size += 1
			sp += 1
		else:
			break
	output = max(output, size)
	p = sp
print(output)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
answer = 1
res = 1
for i in range(1, n):
	if a[i] != a[i - 1]:
		res += 1
	else:
		res = 1
	if res > answer:
		answer = res
if res > answer:
	answer = res
print(answer)


(n, k) = [int(s) for s in input().split()]
a = [int(s) for s in input().split()]
max = -10 ** 10
temp = 0
for i in range(n):
	if i + 1 < len(a) and a[i] != a[i + 1]:
		temp += 1
	elif i + 1 >= len(a) or a[i] == a[i + 1]:
		temp += 1
		if temp > max:
			max = temp
		temp = 0
print(max)


l = c = r = 0
for x in map(int, [*open(0)][1].split()):
	if x == l:
		c = 0
	l = x
	c += 1
	r = max(r, c)
print(r)


y = input()
x = y.split()
house_count = int(x[0])
z = input()
w = z.split()
temp = int(w[0])
count = 1
max_count = 1
for i in range(1, house_count):
	if temp != int(w[i]):
		count += 1
	else:
		count = 1
	max_count = max(max_count, count)
	temp = int(w[i])
print(max_count)


(n, k) = map(int, input().split())
A = list(map(int, input().split()))
ans = i = j = 0
while i < n:
	j = i + 1
	while j < n and A[j - 1] != A[j]:
		j += 1
	ans = max(ans, j - i)
	i = j
print(ans)


(n, k) = map(int, input().strip().split())
arr = list(map(int, input().strip().split()))
arr.append(arr[n - 1])
ans = 1
az = []
for i in range(n):
	if arr[i] != arr[i + 1]:
		ans += 1
	else:
		az.append(ans)
		ans = 1
if len(arr) == 0:
	print(ans)
else:
	print(max(az))


input()
prev = ''
x = x_max = 0
for a in input().split():
	if a == prev:
		x = 1
	else:
		x += 1
		x_max = max(x_max, x)
	prev = a
print(x_max)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
mx = 1
ct = 1
for i in range(1, n):
	if a[i] != a[i - 1]:
		ct += 1
	mx = max(mx, ct)
	if a[i] == a[i - 1]:
		ct = 1
print(mx)


(n, m) = map(int, input().split())
mas = list(map(int, input().split()))
(res, q) = (0, 1)
for i in range(n - 1):
	if mas[i] != mas[i + 1]:
		q += 1
	else:
		if q > res:
			res = q
		q = 1
if res < q:
	res = q
print(res)


(n, k) = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
count = 1
p = a[0]
num = 0
if n == 1:
	print(1)
else:
	for i in a[1:]:
		if i != p:
			p = i
			count += 1
		else:
			if num < count:
				num = count
			count = 1
	else:
		if num < count:
			num = count
	print(num)


i = list(map(int, input().split()))
v = list(map(int, input().split()))
t = 0
f = 0
pc = 0
for i in range(i[0]):
	if pc != v[i]:
		t += 1
		pc = v[i]
	elif t > f:
		f = t
		t = 1
		pc = v[i]
	else:
		t = 1
		pc = v[i]
print(max(f, t))


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
a += [a[-1]]
maxl = 1
now = 1
for i in range(n):
	if a[i] != a[i + 1]:
		now += 1
	else:
		maxl = max(maxl, now)
		now = 1
print(max(maxl, now))


(n, k) = map(int, input().split())
houses = map(int, input().split())
counter = 0
previous_color = None
temporary_counter = 0
for color in houses:
	if previous_color != color:
		if temporary_counter == 0 and previous_color != None:
			temporary_counter += 2
		else:
			temporary_counter += 1
	else:
		temporary_counter = 0
	if counter < temporary_counter:
		counter = temporary_counter
	previous_color = color
print(counter)


(n, k) = map(int, input().split())
if n == 1:
	print('1')
	exit()
l = input().split()
c = 1
z = set()
for i in range(1, n):
	if l[i] == l[i - 1]:
		z.add(c)
		c = 1
	else:
		c += 1
		z.add(c)
print(max(z))


n = input().split()
n[0] = int(n[0])
a = input().split()
for i in range(n[0]):
	a[i] = int(a[i])
j = []
c = 1
if n[0] == 1:
	print(1)
else:
	for i in range(n[0] - 1):
		if i + 1 == n[0] - 1 and a[i] != a[i + 1]:
			c += 1
			j.append(c)
		elif a[i] != a[i + 1]:
			c += 1
		else:
			j.append(c)
			c = 1
	t = max(j)
	print(t)


(n, k) = map(int, input().split())
road = list(map(int, input().split()))
answ = 0
m = []
p = 0
for i in road:
	if i != p:
		answ += 1
	else:
		answ = 1
	p = i
	m.append(answ)
print(max(m))


(n, k) = [int(p) for p in input().split()]
arr = [int(p) for p in input().split()]
if len(arr) == 1:
	print(1)
elif len(set(arr)) == len(arr):
	print(n)
else:
	ind = 0
	curr = 0
	for i in range(len(arr) - 1):
		if arr[i] == arr[i + 1]:
			curr = max(curr, i - ind + 1)
			ind = i + 1
	curr = max(curr, n - ind)
	print(curr)


import sys

def check(houses):
	prev = houses[0]
	res = 0
	count = 1
	for i in range(1, len(houses)):
		if prev == houses[i]:
			res = max(res, count)
			count = 1
		else:
			count += 1
		prev = houses[i]
	return max(res, count)

def main():
	(n, k) = map(int, sys.stdin.readline().split())
	arr = [int(x) for x in sys.stdin.readline().split()]
	print(check(arr))
main()


def main_function():
	(n, k) = [int(i) for i in input().split(' ')]
	a = [int(i) for i in input().split(' ')]
	max_counter = 1
	counter = 1
	current_house = a[0]
	for i in range(1, len(a)):
		if current_house == a[i]:
			counter = 1
		else:
			counter += 1
			current_house = a[i]
		if counter > max_counter:
			max_counter = counter
	print(max_counter)
main_function()


import math
inarr = lambda : map(int, input().split())
for _ in range(1):
	(n, k) = map(int, input().split())
	s = list(inarr())
	le = 1
	ans = 1
	i = 0
	while i < n - 1:
		if s[i] != s[i + 1]:
			le += 1
		else:
			ans = max(ans, le)
			le = 1
		i = i + 1
	ans = max(ans, le)
	print(ans)


import sys, copy
(n, k) = map(int, sys.stdin.readline().split())
arr = list(map(int, sys.stdin.readline().split()))
start = 0
end = 0
ans = 0
for i in range(1, n):
	if arr[i] != arr[end]:
		end = i
	else:
		ans = max(ans, end - start + 1)
		start = i
		end = i
ans = max(ans, end - start + 1)
print(ans)


input()
s = list(map(int, input().split()))
res = 1
cnt = 1
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		cnt = 1
	else:
		cnt += 1
	res = max(res, cnt)
print(res)


(a, b) = map(int, input().split())
t = list(map(int, input().split()))
if a == 1:
	print(1)
else:
	u = 0
	x = 0
	for k in range(1, a):
		if t[k] != t[k - 1]:
			u += 1
		elif u + 1 > x:
			x = u + 1
			u = 0
		else:
			u = 0
	if u + 1 > x:
		x = u + 1
	print(x)


(n, k) = map(int, input().split())
a = [int(x) for x in input().split()]
x = 1
y = 1
for i in range(1, len(a)):
	if a[i] != a[i - 1]:
		x += 1
		if x >= y:
			y = x
	else:
		x = 1
print(y)


info = input()
colors = input()
info = info.split()
colors = colors.split()
colors = [int(x) for x in colors]
num_houses = info[0]
num_colors = info[1]
z = 0
longest = 0
for (y, color) in enumerate(colors):
	if y + 1 == len(colors):
		break
	if color != int(colors[y + 1]):
		z += 1
	else:
		if z > longest:
			longest = z
		z = 0
if z > longest:
	longest = z
print(longest + 1)


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
q = 0
x = 1
for i in range(1, n):
	if l[i] != l[i - 1]:
		x += 1
	else:
		q = max(x, q)
		x = 1
q = max(x, q)
print(q)


input()
houses = input().split(' ')
maxwalk = 1
currentwalk = 1
rhs = houses[0]
for i in range(1, len(houses)):
	lhs = houses[i]
	if rhs != lhs:
		currentwalk += 1
		maxwalk = max(maxwalk, currentwalk)
	else:
		currentwalk = 1
	rhs = lhs
print(maxwalk)


import sys
arr = list(map(int, sys.stdin.readline().rstrip().split(' ')))
arr1 = list(map(int, sys.stdin.readline().rstrip().split(' ')))
list1 = []
if len(arr1) == 0:
	list1.append(1)
elif len(arr1) == 1:
	list1.append(1)
else:
	j = 0
	sum1 = 1
	while j < len(arr1) - 1:
		while arr1[j] != arr1[j + 1]:
			sum1 += 1
			j += 1
			if j >= len(arr1) - 1:
				break
		list1.append(sum1)
		sum1 = 1
		j = j + 1
print(max(list1))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
l = 1
x = []
for i in range(len(a) - 1):
	if a[i] != a[i + 1]:
		l += 1
		if i == len(a) - 2:
			x.append(l)
	else:
		x.append(l)
		l = 1
if x == []:
	x.append(len(a))
print(max(x))


n = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr2 = list()
t = int(n[0])
d = int(n[1])
ar3 = set(arr)
cnt = 0
l = 1
if t == 1:
	arr2.append(t)
elif t == d and len(ar3) == t:
	arr2.append(t)
else:
	for i in range(t - 1):
		if arr[i] != arr[i + 1]:
			cnt = cnt + 1
		else:
			cnt = cnt + 1
			arr2.append(cnt)
			cnt = 0
	arr2.append(cnt + 1)
print(max(arr2))


(n, k) = [int(s) for s in input().split(' ')]
house = list(map(int, input().split()))
length = 1
maxlength = 1
for i in range(n - 1):
	if house[i] != house[i + 1]:
		length += 1
		maxlength = max(length, maxlength)
	else:
		maxlength = max(length, maxlength)
		length = 1
print(maxlength)


(n, k) = [int(s) for s in input().split()]
l_col = input().split()
arr_maxlen = [0] * n
arr_maxlen[0] = 1
max_ind = 0
for i in range(1, n):
	arr_maxlen[i] = arr_maxlen[i - 1] + 1 if l_col[i] != l_col[i - 1] else 1
print(max(arr_maxlen))


def get_max_segment(colors):
	segments = []
	current = 1
	for i in range(len(colors) - 1):
		if colors[i] != colors[i + 1]:
			current += 1
		else:
			segments.append(current)
			current = 1
	segments.append(current)
	return max(segments)
n = input()
colors = list(map(int, input().split()))
print(get_max_segment(colors))


str1 = input()
(n, k) = str1.strip().split()
n = int(n)
k = int(k)
str2 = input()
arr = [int(i) for i in str2.strip().split()]
maxSeg = 1
front = 0
back = 0
i = 0
while i < n:
	back = i
	front = i
	while i < n - 1 and arr[i + 1] != arr[i]:
		i += 1
	front = i
	seg = front - back + 1
	if seg > maxSeg:
		maxSeg = seg
	while i < n - 1 and arr[i + 1] == arr[i]:
		i += 1
	if i == n - 1:
		break
print(maxSeg)


(a, b) = map(int, input().split())
c = list(map(int, input().split()))
d = []
e = 0
for x in range(len(c)):
	if len(c) == 1:
		d.append(1)
	elif x == len(c) - 1:
		if c[x] != c[x - 1]:
			e += 1
			d.append(e)
	elif c[x] != c[x + 1]:
		e += 1
	else:
		e += 1
		d.append(e)
		e = 0
d.sort()
print(d[-1])


(n, k) = list(map(int, input().split()))
a = []
for i in range(n):
	a.append(0)
a = list(map(int, input().split()))
count = 0
r = 0
for i in range(len(a) - 1):
	if a[i] != a[i + 1]:
		count = count + 1
	else:
		if count + 1 > r:
			r = count + 1
		count = 0
	if i == len(a) - 2 and a[len(a) - 2] != a[len(a) - 1] and (r < count + 1):
		r = count + 1
if n == 1:
	r = 1
print(r)


(n, k) = map(int, input().split())
s = [int(i) for i in input().split()]
s.append(0)
cnt = 1
c = 1
d = []
(l, r) = (0, 1)
while r < n:
	if s[l] != s[r]:
		cnt += 1
		l += 1
		r += 1
	else:
		c = max(c, cnt)
		l = r
		r += 1
		cnt = 1
print(max(c, cnt))


Y = lambda : list(map(int, input().split()))
P = lambda : map(int, input().split())
(n, k) = P()
a = Y()
(nxt, mx) = (0, 0)
for i in range(1, n):
	if a[i] == a[i - 1]:
		mx = max(mx, i - nxt)
		nxt = i
print(max(mx, n - nxt))


(n, k) = map(int, input().split())
path = list(map(int, input().split()))
longest = 1
temp_longest = 1
previous = path[0]
if len(path) == 2 and path[0] != path[1]:
	longest = 2
else:
	for step in range(1, n):
		if path[step] != previous:
			temp_longest += 1
		else:
			if temp_longest > longest:
				longest = temp_longest
			temp_longest = 1
		if temp_longest > longest:
			longest = temp_longest
		previous = path[step]
print(longest)


(a, b) = map(int, input().split())
res = list(map(int, input().split()))
count = 1
maxx = 1
for i in range(len(res) - 1):
	num = res[i]
	if num != res[i + 1]:
		count += 1
		maxx = max(count, maxx)
	else:
		count = 1
print(maxx)


(n, k) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
m = 0
temp = 1
if len(a) > 1:
	for i in range(1, n):
		if a[i] == a[i - 1]:
			temp = 1
		else:
			temp += 1
		if temp > m:
			m = temp
else:
	m = 1
print(m)


(a, b) = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
l = []
for i in range(0, len(c) - 1):
	if c[i] == c[i + 1]:
		l.append(i)
if len(l) == 0:
	print(a)
elif len(l) == 1:
	print(max(l[0] + 1, a - l[0] - 1))
else:
	g = l[0] + 1
	e = a - l[len(l) - 1] - 1
	h = -10 ** 9
	for i in range(1, len(l)):
		i = l[i] - l[i - 1]
		if i > h:
			h = i
	print(max(max(g, e), h))


(n, k) = list(map(int, input().split()))
house_li = list(map(int, input().split()))
last = house_li[-1]
house_li.append(last)
cnt = 0
res_li = []
for i in range(len(house_li) - 1):
	cnt += 1
	if house_li[i] == house_li[i + 1]:
		res_li.append(cnt)
		cnt = 0
print(max(res_li))


a = input().split()
x = int(a[0])
y = int(a[1])
i = 0
v = input().split()
r = 0
lst = []
z = list(set(v))
if len(z) == 1:
	print('1')
else:
	while i < x - 1:
		p = int(v[i])
		q = int(v[i + 1])
		if p != q:
			r = r + 1
			lst.append(r + 1)
		else:
			r = 0
		i = i + 1
	print(max(lst))


def read_ints():
	return list(map(int, input().split()))
(n, k) = read_ints()
a = read_ints()
ans = 0
anss = []
for i in range(n - 1):
	if a[i] != a[i + 1]:
		ans += 1
	else:
		ans += 1
		anss.append(ans)
		ans = 0
ans += 1
anss.append(ans)
print(max(anss))


arr = input().split(' ')
houses = input().split(' ')
del arr
count = 1
max_count = count
prev = -1
isFirst = 1
for house in houses:
	if isFirst:
		isFirst = 0
		prev = house
		continue
	if prev == house:
		if max_count < count:
			max_count = count
		count = 1
		prev = house
		continue
	count += 1
	prev = house
if max_count < count:
	max_count = count
print(max_count)


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations
from math import gcd, floor, inf, log2, sqrt, log10
from bisect import bisect_right, bisect_left
from statistics import mode
from string import ascii_uppercase
(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
stack = []
best = 0
for color in arr:
	if stack and stack[-1] == color:
		stack = [color]
	else:
		stack.append(color)
	best = max(best, len(stack))
print(best)


(N, K) = map(int, input().split())
A = list(map(int, input().split()))
pre = A[0]
tmp = 1
num = 1
for i in range(1, N):
	if A[i] != pre:
		tmp += 1
		pre = A[i]
	else:
		num = max(num, tmp)
		tmp = 1
		pre = A[i]
num = max(num, tmp)
print(num)


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
ma = 1
start = 0
for j in range(1, len(l)):
	if l[j] != l[j - 1]:
		continue
	else:
		x = j - start
		if x > ma:
			ma = x
		start = j
x = a - start
if x > ma:
	ma = x
print(ma)


(a, b) = map(int, input().split())
b = list(map(int, input().split()))
c = 1
d = 0
e = 0
for i in range(a - 1):
	if b[i] != b[i + 1]:
		c += 1
	else:
		e = max(e, c)
		d = c
		c = 1
e = max(e, c)
print(e)


def main():
	(num_of_houses, num_of_colors) = map(int, input().split())
	house_row = list(input().split())
	max_houses = 0
	local_houses = 0
	last_house = 0
	for house in house_row:
		if house == last_house:
			if local_houses > max_houses:
				max_houses = local_houses
			local_houses = 1
		else:
			last_house = house
			local_houses += 1
	if local_houses > max_houses:
		max_houses = local_houses
	print(max_houses)
main()


n = input()
a = list(map(int, input().split()))
ans = 1
q = [ans]
if len(a) == 1:
	print(a[0])
else:
	for i in range(1, len(a)):
		if a[i - 1] != a[i]:
			ans += 1
		else:
			ans = 1
		q.append(ans)
	print(max(q))


(n, k) = map(int, input().split())
array = list(map(int, input().split()))
array.append(0)
count = 0
ar = [1]
for i in range(len(array) - 1):
	if array[i] == array[i + 1]:
		count += 1
		ar.append(count)
		count = 0
	else:
		count += 1
	if i == len(array) - 2:
		ar.append(count)
print(max(ar))


def ans(arr):
	cnt = 0
	cnt1 = 0
	i = 0
	while i < n - 1:
		if arr[i] != arr[i + 1]:
			cnt += 1
		else:
			cnt1 = max(cnt1, cnt)
			cnt = 0
		i += 1
	cnt1 = max(cnt1, cnt)
	return cnt1 + 1
nk = list(map(int, input().strip().split()))
(n, k) = (nk[0], nk[1])
a = list(map(int, input().strip().split()))
print(ans(a))


(n, k) = [int(i) for i in input().split()]
a = list(map(int, input().split()))
aa = 1
c = 1
for i in range(len(a) - 1):
	if a[i] != a[i + 1]:
		aa += 1
		if aa > c:
			c = aa
	else:
		aa = 1
print(c)


import re
bs = input()

def numberGatherer():
	generalArray = re.findall('[+-]?\\d+', input(''))
	for index in range(0, len(generalArray)):
		generalArray[index] = int(generalArray[index])
	return generalArray
housesRough = numberGatherer()
houses = []
for element in housesRough:
	houses.append(element)
tester = 1
ansCount = 1
for element in range(0, len(houses)):
	if element != 0:
		if houses[element] == houses[element - 1]:
			if tester > ansCount:
				ansCount = tester
			tester = 1
		else:
			tester = tester + 1
	if element == len(houses) - 1 and tester > ansCount:
		ansCount = tester
print(ansCount)


import sys
input = sys.stdin.readline

def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	answer = 1
	carry = 1
	for i in range(n - 1):
		if a[i] == a[i + 1]:
			answer = max(answer, carry)
			carry = 1
		else:
			carry += 1
	return max(answer, carry)
print(main())


(t, k) = map(int, input().split())
l = list(map(int, input().split()))
i = 0
c = 0
m = 0
while i < t:
	if i < t - 1 and l[i] != l[i + 1]:
		c += 1
	elif i == t - 1 and l[i] != l[i - 1]:
		c += 1
	else:
		c += 1
		if c > m:
			m = c
		c = 0
	i += 1
if c > m:
	m = c
print(m)


(n, k) = list(map(int, input().split()))
A = list(map(int, input().split()))
answer = 0
x = 1
for i in range(1, n):
	if A[i] != A[i - 1]:
		x += 1
	else:
		if x > answer:
			answer = x
		x = 1
if x > answer:
	answer = x
print(answer)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
a = dict(zip(range(n), a))
maxl = 1
l = 1
i = 0
while i <= n - 2:
	if a[i] != a[i + 1]:
		l += 1
		if l > maxl:
			maxl = l
	else:
		l = 1
	i += 1
print(maxl)


(n, k) = [int(x) for x in input().split()]
a = [x for x in input().split()]
counter = 0
r = []
pred = a[0]
for i in range(1, n):
	if a[i] != pred:
		counter += 1
	else:
		r.append(counter + 1)
		counter = 0
	pred = a[i]
if counter != 0:
	r.append(counter + 1)
if r != []:
	print(max(r))
else:
	print(1)


def main():
	arr = input().split()
	bound = int(arr[0])
	arr = input().split()
	maximum = 0
	previous = ''
	count = 0
	for x in range(bound):
		if previous != arr[x]:
			count += 1
		else:
			maximum = max(maximum, count)
			count = 1
		previous = arr[x]
	maximum = max(maximum, count)
	print(maximum)
main()


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
count = 0
b = []
for i in range(n - 1):
	if a[i] != a[i + 1]:
		count += 1
	else:
		b.append(count + 1)
		count = 0
b.append(count + 1)
if n == 1:
	print('1')
else:
	print(max(b))


(n, k) = map(int, input().split())
raw_input = input()

def lazy_reader(raw_input):
	number = ''
	for symbol in raw_input:
		if symbol == ' ':
			yield int(number)
			number = ''
		else:
			number += symbol
	yield int(number)
houses = lazy_reader(raw_input)
del raw_input
counter = 0
previous_color = None
temporary_counter = 0
for color in houses:
	if previous_color != color:
		if temporary_counter == 0 and previous_color != None:
			temporary_counter += 2
		else:
			temporary_counter += 1
	else:
		temporary_counter = 0
	if counter < temporary_counter:
		counter = temporary_counter
	previous_color = color
print(counter)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
c = 1
maxi = c
if n == 1:
	print('1')
	exit(0)
if n == 2 and a[0] != a[1]:
	print('2')
	exit(0)
if n == 2 and a[0] == a[1]:
	print('1')
	exit(0)
for i in range(0, n - 1):
	if a[i + 1] == a[i]:
		c = 1
	else:
		c += 1
		if c > maxi:
			maxi = c
print(maxi)


in1 = [int(i) for i in input().split()]
doma = [int(i) for i in input().split()]

def gen_1():
	yield [-1, 0]
	for i in range(0, in1[0] - 1):
		if doma[i] == doma[i + 1]:
			yield [i, i + 1]
	yield [in1[0] - 1, in1[0]]
breaks = list(gen_1())
max = 0
for i in range(0, len(breaks) - 1):
	if breaks[i + 1][1] - breaks[i][1] > max:
		max = breaks[i + 1][1] - breaks[i][1]
print(max)


__author__ = 'Dilshod'
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
mx = -float('inf')
cnt = 1
for i in range(n - 1):
	if a[i] != a[i + 1]:
		cnt += 1
	else:
		mx = max(mx, cnt)
		cnt = 1
mx = max(mx, cnt)
print(mx)


(a, b) = map(int, input().split())
l = list(map(int, input().split()))
c = 0
cnt = 0
ans = 0
for i in range(a):
	if l[i] == c:
		if cnt > ans:
			ans = cnt
		cnt = 0
		cnt += 1
	else:
		cnt += 1
		c = l[i]
if cnt > ans:
	ans = cnt
print(ans)


(n, k) = map(int, input().split())
h = list(map(int, input().split()))
c = 0
pi = None
ct = 0
for i in h:
	if pi != i:
		if ct == 0 and pi != None:
			ct += 2
		else:
			ct += 1
	else:
		ct = 0
	if c < ct:
		c = ct
	pi = i
print(c)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(n, k) = mp()
arr = lmp()
i = 0
c = 1
mx = 1
while i < n - 1:
	if arr[i] == arr[i + 1]:
		mx = max(mx, c)
		c = 1
	else:
		c += 1
	i += 1
print(max(mx, c))


(houses, clrs) = map(int, input().split())
hs = list(map(int, input().split()))
count = 1
temp = 1
strt = hs[0]
for i in range(1, houses):
	if hs[i] != hs[i - 1]:
		temp += 1
		if temp >= count:
			count = temp
	else:
		temp = 1
print(count)


(nb_house, nb_colors) = [int(x) for x in input().split()]
house_colors = [int(x) for x in input().split()]
curr = house_colors[0]
maxs = 1
curr_maxs = 1
for i in house_colors:
	if i != curr:
		curr_maxs += 1
	else:
		curr_maxs = 1
	maxs = max(maxs, curr_maxs)
	curr = i
print(maxs)


(n, k) = map(int, input().split())
arr = list(map(int, input().split()))
if n == 1:
	print(1)
	exit()
if n == 2:
	if arr[0] == arr[1]:
		print(1)
	else:
		print(2)
	exit()
col = 1
i = 0
j = 1
start = 0
mm = 1
c = 1
ans = []
while i < n and j < n:
	if arr[i] != arr[j]:
		c += 1
		mm = max(mm, c)
		j += 1
		i += 1
	else:
		ans.append([mm, start, j])
		c = 1
		i = j
		start = i
		j = j + 1
ans.append([mm, start, j - 1])
ans = sorted(ans, key=lambda item: item[0], reverse=True)
for i in range(len(ans)):
	s = set()
	for j in range(ans[i][1], ans[i][2] + 1):
		s.add(arr[j])
	if len(s) <= k:
		print(ans[i][0])
		break


(n, k) = map(int, input().split())
l = [*map(int, input().split())]
curr = res = 0
for (i, e) in enumerate(l):
	if i != 0 and l[i] == l[i - 1]:
		curr = i
	res = max(res, i - curr + 1)
print(res)


(n, m) = map(int, input().split())
listik = list(map(int, input().split()))
counter = 1
maxs = 0
for i in range(n - 1):
	if listik[i] != listik[i + 1]:
		counter += 1
	else:
		maxs = max(maxs, counter)
		counter = 1
maxs = max(counter, maxs)
print(maxs)


(n, k) = (int(t) for t in input().split())
a = [int(i) for i in input().split()]
temp = a[0]
longest = 1
streak = 0
idx = 0
while idx < n:
	if idx > 0:
		if temp != a[idx]:
			streak += 1
			longest = max(longest, streak)
		else:
			longest = max(longest, streak)
			streak = 1
		temp = a[idx]
	else:
		streak += 1
	idx += 1
print(longest)


[n, k] = list(map(int, input().split()))
a = list(map(int, input().split()))
sum = 0
x = 0.1
m = []
for i in a:
	if i != x:
		sum = sum + 1
		m.append(sum)
		x = i
	else:
		sum = 1
print(max(m))


(n, k) = map(int, input().split())
r = 0
lc = None
lx = 0
for (i, v) in enumerate(map(int, input().split())):
	if v == lc:
		r = max(r, i - lx)
		lx = i
	else:
		lc = v
print(max(r, n - lx))


arr = input().split()
(n, k) = (int(arr[0]), int(arr[1]))
arr1 = input().split()
same = 0
m = 1
for i in range(n - 1):
	if arr1[i] != arr1[i + 1]:
		same += 1
		m = max(m, same + 1)
	elif arr1[i] == arr1[i + 1]:
		same = 0
if n == 1:
	print(1)
else:
	print(m)


(n, k) = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = 0
i = 1
if n == 1:
	print(1)
else:
	while i < n:
		t = 1
		while i < n and a[i] != a[i - 1]:
			t += 1
			i += 1
		i += 1
		ans = max(ans, t)
	print(ans)


(n, k) = map(int, input().split())
L = list(map(int, input().split()))
label = 0
ans = 1
for i in range(1, n):
	if L[i] == L[i - 1]:
		label = i
	cur = i - label + 1
	if cur > ans:
		ans = cur
print(ans)


(n, k) = map(lambda s: int(s), input().split())
m = 0
l = 0
prev = -1
for cur in map(lambda s: int(s), input().split()):
	if cur != prev:
		l += 1
	else:
		if l > m:
			m = l
		l = 1
	prev = cur
if l > m:
	m = l
print(m)


import sys
a = sys.stdin.readline().split()
n = int(a[0])
k = int(a[1])
a = sys.stdin.readline().split()
l = []
for i in range(0, n):
	b = int(a[i])
	l.append(b)
s = set()
q = []
maxWalkLen = 1
currWalkLen = 1
for i in range(1, n):
	if l[i] == l[i - 1]:
		currWalkLen = 1
	else:
		currWalkLen += 1
		if currWalkLen > maxWalkLen:
			maxWalkLen = currWalkLen
print(maxWalkLen)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
seg = [1]
c = 1
for i in range(n - 1):
	if a[i] == a[i + 1]:
		seg.append(c)
		c = 1
	else:
		c = c + 1
		if i == n - 2:
			seg.append(c)
print(max(seg))


(N, M) = map(int, input().split())
L = [int(i) for i in input().split()]
c = 1
best = -1
for i in range(1, len(L)):
	if L[i] == L[i - 1]:
		best = max(best, c)
		c = 1
	else:
		c += 1
best = max(best, c)
print(best)


(n, k) = [int(i) for i in input().split(' ')]
colors = [int(x) for x in input().split(' ')]
max_seg = 1
left = 0
right = 1
current = 1
while left < right and right < n:
	if colors[right] != colors[left]:
		current += 1
	else:
		current = 1
	right += 1
	left += 1
	if current > max_seg:
		max_seg = current
print(max_seg)


def run():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	(cl, ans) = (0, 0)
	for i in range(n):
		cl += 1
		if i + 1 >= n:
			ans = max(ans, cl)
		elif a[i + 1] == a[i]:
			ans = max(ans, cl)
			cl = 0
	print(ans)
run()


nk = input().split()
n = int(nk[0])
k = int(nk[1])
a = [int(i) for i in input().split()]
ans = 1
t = 1
for i in range(n - 1):
	if a[i] == a[i + 1]:
		ans = max(ans, t)
		t = 1
	else:
		t += 1
print(max(ans, t))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
s = set()
cr = 1
for i in range(n - 1):
	if l[i] == l[i + 1]:
		s.add(cr)
		cr = 1
	else:
		cr += 1
s.add(cr)
print(max(s))


from sys import stdin

def inp():
	return stdin.readline().strip()
(n, k) = [int(x) for x in inp().split()]
ar = [int(x) for x in inp().split()]
counter = 0
answer = 0
for i in range(n):
	counter += 1
	if i > 0:
		if ar[i] == ar[i - 1]:
			counter = 1
	answer = max(counter, answer)
print(answer)


(a, b) = [int(j) for j in input().split()]
c = [int(j) for j in input().split()]
(ans, summ) = (0, 1)
for i in range(a - 1):
	if c[i] != c[i + 1]:
		summ += 1
	else:
		if ans < summ:
			ans = summ
		summ = 1
print(max(summ, ans))


(n, k) = map(int, input().split(' '))
li = list(map(int, input().split(' ')))
a = 0
max = 0
flag = False
for i in range(len(li) - 1):
	if li[i] == li[i + 1]:
		flag = True
		b = i + 1
		temp = b - a
		if temp > max:
			max = temp
		a = b
if flag:
	b = len(li)
	temp = b - a
	if temp > max:
		max = temp
	print(max)
else:
	print(len(li))


for i in range(1):
	(n, m) = map(int, input().split())
	l = list(map(int, input().split()))
	count = 1
	mx = 0
	if len(l) > 1:
		for i in range(n - 1):
			if l[i] != l[i + 1]:
				count += 1
			else:
				count = 1
			mx = max(mx, count)
		print(mx)
	else:
		print(1)


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
m = 0
c = 0
for i in range(n):
	c += 1
	if i == n - 1:
		if c > m:
			m = c
		break
	if a[i] == a[i + 1]:
		if c > m:
			m = c
		c = 0
print(m)


qtd = input()
casas = [int(x) for x in input().split()]
maior = 0
aux = []
for i in range(len(casas)):
	if len(aux) >= 1 and casas[i] == aux[len(aux) - 1]:
		if len(aux) > maior:
			maior = len(aux)
		aux = []
	aux.append(casas[i])
	if i == len(casas) - 1:
		if len(aux) > maior:
			maior = len(aux)
print(maior)


(n, k) = map(int, input().split())
s = input().split()
s.append(s[-1])
a = s[0]
b = 1
c = 0
for i in s[1:]:
	if i != a:
		b += 1
		a = i
	else:
		c = max(c, b)
		b = 1
print(c)


(n, k) = map(int, input().split())
a = [int(i) for i in input().split()]
count = 1
max_count = 1
for i in range(1, len(a)):
	if a[i] != a[i - 1]:
		count = count + 1
	else:
		if count > max_count:
			max_count = count
		count = 1
if count > max_count:
	max_count = count
if len(a) == 2 and a[0] != a[1]:
	max_count = 2
print(max_count)


(n, k) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
count = 1
m = 0
for i in range(n - 1):
	if a[i] != a[i + 1]:
		count += 1
	else:
		if count > m:
			m = count
		count = 1
if count > m:
	m = count
print(m)


(houses, colors) = [int(x) for x in input().split()]
house_color = [int(x) for x in input().split()]
houses_segment = [1]
element = 0
for h in range(houses - 1):
	if house_color[h] != house_color[h + 1]:
		houses_segment[element] += 1
	elif house_color[h] == house_color[h + 1]:
		houses_segment.append(1)
		element += 1
print(max(houses_segment))


(a, b) = input().split()
a = int(a)
b = int(b)
casa = input().split()
for x in range(a):
	casa[x] = int(casa[x])
cont = 1
resultado = 1
for x in range(1, a):
	if casa[x - 1] == casa[x]:
		if cont > resultado:
			resultado = cont
			cont = 1
		else:
			cont = 1
	elif x == a - 1:
		cont = cont + 1
		if cont > resultado:
			resultado = cont
	else:
		cont = cont + 1
print(resultado)


en = list(map(int, input().split()))
n = en[0]
k = en[1]
houses = list(map(int, input().split()))
segments = []
counter = 1
for i in range(1, n):
	if houses[i] != houses[i - 1]:
		counter += 1
	else:
		segments.append(counter)
		counter = 1
segments.append(counter)
print(max(segments))


(n, k) = map(int, input().split())
a = list(map(int, input().split()))
ans = []
ans1 = 0
for I in range(n - 1):
	if a[I] != a[I + 1]:
		ans1 += 1
	else:
		ans.append(ans1 + 1)
		ans1 = 0
ans.append(ans1 + 1)
print(max(ans))


(n, k) = map(int, input().split())
l = list(map(int, input().split()))
m = []
f = []
s = set(l)
if len(s) == 1:
	print('1')
else:
	for i in range(len(l) - 1):
		if l[i] == l[i + 1]:
			f.append(m)
			m = []
		else:
			if len(m) == 0:
				m.append(l[i])
			m.append(l[i + 1])
	j = sorted(f, key=len, reverse=True)
	if len(f) != 0:
		if len(j[0]) < len(m):
			print(len(m))
		else:
			j = sorted(f, key=len, reverse=True)
			if j[0]:
				print(len(j[0]))
			else:
				print(len(m))
	else:
		print(len(m))


(n, k) = map(int, input().rstrip().split(' '))
l = list(map(int, input().rstrip().split(' ')))
if n == 1:
	print(1)
else:
	le = 1
	max_le = 1
	for i in range(n - 1):
		if l[i] == l[i + 1]:
			if le > max_le:
				max_le = le
			le = 0
		le = le + 1
	if le > max_le:
		max_le = le
	print(max_le)


str_0 = input()
list_0 = str_0.split()
n = int(list_0[0])
k = int(list_0[1])
str_1 = input()
list_1 = str_1.split()
n_1 = 1
list_2 = []
if n > 1:
	if n > 2:
		for i in range(n - 1):
			if list_1[i] == list_1[i + 1]:
				list_2.append(n_1)
				n_1 = 1
			else:
				n_1 += 1
		list_2.append(n_1)
	elif list_1[0] == list_1[1]:
		list_2.append(1)
	else:
		list_2.append(2)
else:
	list_2.append(1)
list_2.sort()
if len(list_2) == 1:
	print(list_2[0])
else:
	print(list_2[-1])


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
import math
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	x = 1
	y = 1
	for i in range(n - 1):
		if a[i] != a[i + 1]:
			x += 1
		else:
			x = 1
		y = max(x, y)
	print(y)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


v = input()
v = v.split()
w = input()
w = w.split()
m = 1
c = 1
i = 1
while i < len(w):
	if int(w[i]) == int(w[i - 1]):
		m = max(c, m)
		c = 0
	c += 1
	i += 1
m = max(c, m)
print(m)


[n, k] = list(map(int, input().strip().split()))
house = list(map(int, input().strip().split()))
(start, end, l_max) = (0, 0, 1)
for i in range(n - 1):
	if house[i] == house[i + 1]:
		l_max = max(l_max, end - start + 1)
		start = i + 1
	end += 1
print(max(l_max, end - start + 1))


x = [int(x) for x in input().strip().split()]
a = [int(a) for a in input().strip().split()]
r = int(1)
l = int(0)
ans = int(0)
while r < x[0]:
	if a[r] != a[r - 1]:
		r += 1
	else:
		if r - l > ans:
			ans = r - l
		l = r
		r += 1
if r - l > ans:
	ans = r - l
print(ans)


(n, k) = map(int, input().split())
l = [int(num) for num in input().split()]
(c, max) = (0, 0)
for i in range(n - 1):
	if l[i] != l[i + 1]:
		c = c + 1
		if c > max:
			max = c
	else:
		c = 0
print(max + 1)


(n, k) = map(int, input().split())
seq = list(map(int, input().split()))
ans = 0
last = 0
mx = 0
for s in seq:
	if last != s:
		ans += 1
	else:
		ans = 1
	last = s
	mx = max(mx, ans)
print(mx)


get = lambda : map(int, input().split())
(n, l) = get()
inp = list(get())
m = 1
ans = 1
for i in range(1, n):
	if inp[i] == inp[i - 1]:
		m = 1
	else:
		m += 1
	ans = max(ans, m)
print(ans)


a = list(map(int, input().split()))
b = list(map(int, input().split()))
k = 1
t = []
if len(b) > 1:
	for j in range(len(b) - 1):
		if b[j] != b[j + 1]:
			k = k + 1
			t.append(k)
		elif b[j] == b[j + 1]:
			t.append(k)
			k = 1
	print(max(t))
else:
	print(len(b))


(n, k) = tuple(map(int, input().split()))
best = 0
curr = 1
res = list(map(int, input().split()))
if n is 1:
	print('1')
else:
	for i in range(1, n):
		if res[i] is res[i - 1]:
			if best < curr:
				best = curr
			curr = 1
		else:
			curr = curr + 1
	if best < curr:
		best = curr
	print(best)


(n, k) = (int(v) for v in input().split())
list1 = [int(u) for u in input().split()]
temp = 1
ans = 1
for i in range(1, n):
	if list1[i] != list1[i - 1]:
		temp += 1
	else:
		ans = max(temp, ans)
		temp = 1
ans = max(temp, ans)
print(ans)


(n, k) = input().split()
n = int(n)
k = int(k)
array = input().split()
fin = []
for i in array:
	fin.append(int(i))
i = 1
sums = 1
maxm = 1
while i < n:
	if fin[i] != fin[i - 1]:
		sums += 1
	else:
		sums = 1
	if sums > maxm:
		maxm = sums
	i += 1
print(maxm)


first = input()
values = first.split()
houses = int(values[0])
colors = int(values[1])
second = input()
house_color = second.split()
lst = []
for i in range(houses):
	if i < houses - 1:
		if house_color[i] == house_color[i + 1]:
			lst.append(i + 1)
	elif i == houses - 1:
		lst.append(houses)
lst.append(0)
lst2 = sorted(lst)
maxhouses = -1
for i in range(0, len(lst2) - 1):
	temp = lst2[i + 1] - lst2[i]
	maxhouses = max(maxhouses, temp)
print(maxhouses)


(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
i = 0
ans = 1
while i < len(arr) - 1:
	count = 1
	while i < len(arr) - 1 and arr[i] != arr[i + 1]:
		count = count + 1
		i = i + 1
	if count > ans:
		ans = count
	i = i + 1
print(ans)


(n, k) = list(map(int, input().strip().split()))
colors = list(map(int, input().strip().split()))
l = 0
previ = -1
for i in range(n - 1):
	if colors[i] == colors[i + 1]:
		cl = i - previ
		if cl > l:
			l = cl
		previ = i
if previ == -1:
	l = n
else:
	cl = n - 1 - previ
	if cl > l:
		l = cl
print(l)


(n, k) = map(int, input().split())
s = list(map(int, input().split()))
d = s[0]
a = 1
b = 1
for i in range(1, n):
	if d != s[i]:
		a += 1
	else:
		a = 1
	d = s[i]
	if a > b:
		b = a
print(b)


(n, k) = [int(x) for x in input().split()]
doma = [int(x) for x in input().split()]
doma.append(doma[-1])
counter = 0
tot = 0
prev = 0
for item in doma:
	if item != prev:
		counter += 1
	else:
		if counter > tot:
			tot = counter
		counter = 1
	prev = item
print(tot)