Hi, trying to figure out this error "Be sure that the program works correctly if the sequence consists of numbers greater than 127." Can somebody explain where I went wrong? Thanks.
P.s. Seems like program working fine, still FAIL to pass.
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 {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i=0; i<10; i++){
int num = Integer.parseInt(reader.readLine());
list.add(num);
}
int count = 0;
ArrayList<Integer> temp = new ArrayList<Integer>();
for(int i=1; i<list.size(); i++){
if(list.get(i-1)==list.get(i)){
count++;
if(i==list.size()-1){
temp.add(count+1);
}
} else {
temp.add(count+1);
count = 0;
}
}
System.out.println(Collections.max(temp));
}
}