This my code:
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 {
// Create list of numbers
ArrayList<Integer>list = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// Add 10 numbers to the list
for (int i = 0 ; i < 10 ; i++){
int n = Integer.parseInt(reader.readLine());
list.add(n);
}
// Display the length long sequence
int count = 1;
int maxCount = 1;
for (int i = 1 ; i < 10 ; i++){
if ( list.get(i-1) != list.get(i)){
count = 1;
}
else
count ++;
if (maxCount < count){
maxCount = count;
}
}
System.out.println(count);
}
}