package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
Integer n = Integer.parseInt(br.readLine());
list.add(n);
}
int counterA = 1;
int counterB = 0;
for (int i = 0; i < list.size()-1; i++) {
if (list.get(i).equals(list.get(i + 1)))
counterA++;
else if (counterA > counterB) {
counterB =+ counterA;
counterA = 1;
}
}
if (counterA > counterB) {
counterB = counterA;
}
System.out.println(counterB);
}
}
package com.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
/*
Longest sequence
*/
public class Solution {
public static void main(String[] args) throws IOException {
//write your code here
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
Integer n = Integer.parseInt(br.readLine());
list.add(n);
}
int counterA = 1;
int counterB = 0;
for (int i = 0; i < list.size()-1; i++) {
if (list.get(i) == (list.get(i + 1)))
counterA++;
if (counterA > counterB) {
counterB = counterA;
counterA = 1;
}
}
System.out.println(counterB);
}
}