public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
ArrayList<Integer> list = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 10; i++) {
list.add(Integer.parseInt(sc.nextLine()));
}
int max = 0;
int counter = 1;
for (int i = 0; i < list.size()-1; i++) {
if(list.get(i).equals(list.get(i+1))){
counter++;
if(counter > max)
max = counter;
}
else {
counter = 1;
}
}
System.out.print(max);
}
}
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
ArrayList<Integer> list = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
for (int i = 0; i < 10; i++) {
list.add(Integer.parseInt(sc.nextLine()));
}
int max = 0;
int counter = 1;
for (int i = 0; i < list.size()-1; i++) {
if(list.get(i).equals(list.get(i+1))){
counter++;
if(counter > max)
max = counter;
}
else {
counter = 1;
}
}
System.out.print(max);
}
}