I spent a lot of time testing the code with different inputs, i got it to run according to the task conditions but it still fails to verify. I am out of options, i need your help caring Java community. Thanks.
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Longest sequence
*/
public class Solution {
static int count = 1;
public static int sequence() throws IOException{
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i= 0; i < 10; i++){
list.add(i, Integer.parseInt(read.readLine()));
}
for(int i = 0; i < list.size()-1; i++){
if (list.get(i) == list.get(i + 1)) {
count++;
//System.out.println(i);
// System.out.println(count);
}
}
return count;
}
public static void main(String[] args) throws IOException {
//write your code here
// System.out.println();
System.out.println(sequence());
//System.out.println();
}
}