donno what's wrong in this last condition is not met
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader bon = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<Integer>();
for(int i=0; i<10; i++){
int n = Integer.parseInt(bon.readLine());
list.add(n);
}
int countA=0; //initialise a to 0
int countB=1; //initialise b =1
for (int i=0; i<list.size()-1; i++){ //use for loop to call the list of elements -1
if(list.get(i).equals(list.get(i+1))){ //checks list of elements is equals to list of elements +1
countB++; //if yes increment by 1
}
else
if(countA >= countB)
{
countB = 1; //if no assign to 1
}
if(countA < countB){
countA = countB;
}
}
System.out.println(countB);//write your code here
}
}