Error: be sure length of the string is calculated correctly at the end of the list
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.*;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int count = 1;
int max = 0;
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i=0; i<10; i++){
list.add(i, Integer.parseInt(bf.readLine()));
}
for(int i=0; i<9; i++){
if(list.get(i).equals(list.get(i+1))){
count++;
}
else{
if(max < count) {max = count;}
count = 1;
}
}
System.out.println(max);
}
}