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
ArrayList<Integer> numbers = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
for(int i = 0; i < 10; i++) {
numbers.add(sc.nextInt());
}
int j = 0;
int k = 0;
//int m = 0;
for(int i = 0; i < numbers.size()-1; i++) {
if(numbers.get(i) == numbers.get(i+1)) {
j++;
k += j;
//m = k;
}
else if(numbers.get(i) != numbers.get(i+1)) {
k = j;
j = 1;
continue;
}
else break;
}
System.out.println(k);
}
}

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
ArrayList<Integer> numbers = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
for(int i = 0; i < 10; i++) {
numbers.add(sc.nextInt());
}
int j = 0;
int k = 0;
//int m = 0;
for(int i = 0; i < numbers.size()-1; i++) {
if(numbers.get(i) == numbers.get(i+1)) {
j++;
k += j;
//m = k;
}
else if(numbers.get(i) != numbers.get(i+1)) {
k = j;
j = 1;
continue;
}
else break;
}
System.out.println(k);
}
}