Hello,
Someone can help me I don't know why it don't work
package fr.codegym.task.task08.task0812;
import java.io.*;
import java.util.ArrayList;
/*
La plus longue séquence
*/
public class Solution {
public static void main(String[] args) throws IOException {
// écris ton code ici
BufferedReader buffered = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Integer> liste = new ArrayList<>();
for (int i = 0; i < 10; i++) {
liste.add(Integer.parseInt(buffered.readLine()));
}
int max = -2147483648;
int counter = 0;
boolean serie = true;
for (int i = 0; i < liste.size(); i++) {
if ((i < liste.size() - 1) && liste.get(i) == liste.get(i + 1)) {
if (!serie) {
counter = 0;
}
++counter;
serie = true;
} else if (i > 0 && liste.get(i - 1) == liste.get(i)) {
if (!serie) {
counter = 0;
}
++counter;
serie = true;
} else {
counter = 1;
serie = false;
}
if (counter > max) {
max = counter;
}
}
System.out.println(max);
}
}