How to reslove this task?
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 reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> num = new ArrayList<>();
for(int i = 0; i<10; i++){
num.add(Integer.parseInt(reader.readLine()));
}
int count = 1;
for(int i=0; i<num.size(); i++){
if(num.get(i).equals(num.get(i+1))){
count++;
}
else continue;
}
System.out.println(count);
//write your code here
}
}