410024: GYM103920 B Anya's Rocks

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

B. Anya's Rockstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Anya has a row of $$$N$$$ rocks that are each painted one of $$$C$$$ possible colors. Although Anya likes all kinds of rocks, she will throw a fit if two adjacent rocks have the same color. She wants to select the longest possible contiguous subsequence of rocks in the row such that no two adjacent rocks have the same color. Can you help our heroine find the longest segment with this property?

Input

The first line contains two integers $$$N$$$ and $$$C$$$ ($$$1 \leq N, C \leq 100$$$), representing the number of rocks and the number of colors, respectively. The next line contains $$$N$$$ space-separated integers $$$c_i$$$ ($$$1 \leq c_i \leq C$$$) which denote the colors of the rocks along the row.

Output

Output a single integer representing the maximum number of rocks on the segment having no two adjacent rocks with the same color.

ExampleInput
8 5
4 4 1 2 3 3 5 1
Output
4
Note

We can select contiguous subsequence [4 1 2 3] in the sample test case.

加入题单

算法标签: