The verification is saying "
Be sure that the length of the longest sequence is calculated correctly when it is located at the end of the list of entered numbers." But I thing I took care of this issue.
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Time for 10,000 get calls
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<Integer>();
ArrayList<Integer> listRep = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
list.add(Integer.parseInt(reader.readLine()));
}
int S;
int n = list.size();
for (int i = 0; i < n-1; i++) {
if (list.get(i) != list.get(i+1)) {
S = 1;
listRep.add(S);
if (i+1 == n-1) {
S = 1;
listRep.add(S);
}
}
else {
S = 1;
while (list.get(i) == list.get(i+1)) {
S++;
i++;
}
listRep.add(S);
if(i+1 == n-1) {
S = 1;
listRep.add(S);
}
}
}
// find the maximum
int maxT = listRep.get(0);
int vT;
for (int i = 1; i < listRep.size(); i++) {
vT = listRep.get(i);
if (vT > maxT) {
maxT = vT;
}
}
System.out.println(maxT);
}
}