If I run the program in my Opinion it does, what it should do, but the verification seems to think different about it.
Who can give me some advice?
package de.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Längste Zeichenkette
*/
public class Solution {
private static ArrayList<String> strings = new ArrayList<String>();
public static void main(String[] args) throws Exception {
//schreib hier deinen Code
fillList(5);
int maxLength = findMaxLength(strings);
printAllOfCertainLength(strings, maxLength);
}
private static void printAllOfCertainLength(ArrayList<String> list, int length)
{
for(int i=0;i<list.size();i++)
{
if(list.get(i).length()==length)
System.out.println(list.get(i));
}
}
private static void fillList(int maxValues) throws Exception
{
BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
for(int i=0; i<maxValues; i++)
{
strings.add(rd.readLine());
}
}
private static int findMaxLength(ArrayList<String> list)
{
int max=0;
for(int i=0;i<list.size();i++)
{
if(list.get(i).length()>max)
max=list.get(i).length();
}
return max;
}
}