Idon't understand.
My exit is:
grand-père
grand-mère
With the (-) they are = 10.
The anothers are more small (programme = 9)
Why it's wrong? We take (-) or not?
package fr.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
La chaîne la plus longue
*/
public class Solution {
private static List<String> chaines;
public static void main(String[] args) throws Exception {
BufferedReader lecteur = new BufferedReader(new InputStreamReader(System.in));
chaines = new ArrayList<String>();
int max =0;
for (int i = 0; i < 5; i++ )
{
chaines.add(lecteur.readLine());
max = chaines.get(0).length();
if (chaines.get(i).length()> max )
{
max = chaines.get(i).length();
}
}
for (String chaine : chaines)
{
if (chaine.length() == max) {
System.out.println(chaine);
}
}
}
//écris ton code ici
}