I've been trying all kind of input list and the result turned out right. Yet they don't let me pass the last condition.
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 {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<Integer>();
int maxSequence = 1;
int max =0;
int finalMax=0;
for(int i = 0 ; i < 10 ; i++)
{
int number = Integer.parseInt(input.readLine());
list.add(i,number);
}
for(int i =0; i<list.size()-1; i++)
{
if(list.get(i).equals(list.get(i+1))){
maxSequence++;
max = maxSequence;
if(finalMax<=max)
{
finalMax=max;
}
}
else
{
maxSequence =1;
}
}
System.out.println(finalMax);
}
}