aasada
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 here
Scanner scr = new Scanner ( System.in );
ArrayList<Integer> intgr = new ArrayList<>();
for(int i = 0 ; i < 10; i++){
intgr.add ( scr.nextInt () );
}
/*for(int j = 0 ; j < intgr.size (); j++){
System.out.println (intgr.get ( j ));
}*/
// Number of numbers in the current sequence
int count = 1;
// Number which is part of the longest sequence so far
int longestNum = intgr.get ( 0 );
// Number of numbers in the longest sequence we've seen so far
int longestCount = 1;
for (int i = 1; i < intgr.size (); i++)
{
// We're starting a new sequence
if (intgr.get ( i ) != intgr.get ( i-1 ))
{
count = 0;
}
count++;
// Have we just found a new longest sequence?
if (count > longestCount)
{
longestCount = count;
longestNum = intgr.get ( i );
}
}
System.out.println (longestCount);
}
}