the last condition is not fulfilled.
It says -- Be sure that the program works correctly if the sequence consists of numbers greater than 127.
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 {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<>();
ArrayList<Integer> count = new ArrayList<>();
for(int i = 0; i < 10; i++){
list.add(Integer.parseInt(reader.readLine()));
}
int c = 1;
for(int i = 0; i < list.size()-1; i++){
if(list.get(i) == list.get(i+1))
c++;
else {
count.add(c);
c = 1;
}
}
count.add(c);
Collections.sort(count, Collections.reverseOrder());
System.out.println(count.get(0));
}
}