All seems to be working, but last condition not matched.
I think the problem is in my second loop, it seems not taking the last value of the list. But I couldn't fix it (writes a bug that it is out of the ArrayList index).
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList <Integer> list= new ArrayList <Integer>();
ArrayList <Integer> sequenceSizes= new ArrayList <Integer>();
int count=1;
for(int k=0; k<10; k++)
{
int num=Integer.parseInt(reader.readLine()) ;
list.add(num);
}
for(int i=0; i<9; i++)
{
int a=list.get(i);
int b=list.get(i+1);
if (a==b)
count++;
else{
sequenceSizes.add(count);
count=1;
}
}
int max;
max=sequenceSizes.get(0);
for(Integer g: sequenceSizes)
if(g>max)
max=g;
System.out.println(max);
}}