This is the recommendation I get from the mentor
Be sure that the length of the longest sequence is calculated correctly when it is located at the end of the list of entered numbers.f
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<>();
for(int i = 0; i <10; i++){
list.add(Integer.parseInt(br.readLine()));
}
int count1 = 1;
int count = 0;
for(int i = 1; i < 10; i++){
if(list.get(i).equals(list.get(i-1)))
count1++;
if(count1 > count)
count = count1;
else
count1 = 1;
}
System.out.println(count);
}
}