I think I have done it, I go trough all my test cases, but I still don't pass the last condition.... Any advice?
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.*;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code her
Scanner scan = new Scanner(System.in);
ArrayList<Integer> nums = new ArrayList<Integer>();
for(int i = 0; i < 10; i++){
nums.add(Integer.parseInt(scan.nextLine()));
}
int counter = 1;
int temp = 0;
int max = 0;
for(int i = 0; i < nums.size() - 1; i++){
if(nums.get(i) == nums.get(i + 1)){
counter++;
temp = counter;
if(temp > max) max = temp;
}else{
counter = 1;
}
}
System.out.println(max);
}
}