Hey community,
my programm is working fine and is fullfilling the task conditions but is not accepted as the solution.
Can you pls help me find the issue ?
Thanks,
Noah
package com.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Longest string
*/
public class Solution {
private static List<String> strings;
public static void main(String[] args) throws Exception {
strings = new ArrayList<>();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 5; i++){
strings.add(br.readLine());
}
String laengstes = strings.get(1);
for (int i = 1; i < 5; i++){
if (strings.get(i).length() > laengstes.length()){
laengstes = strings.get(i);
}
}
System.out.println(laengstes);
for (int i = 0; i < 5; i++){
if (strings.get(i).length() == laengstes.length()){
if (strings.get(i).equals(laengstes)){
break;
}
else{
System.out.println(strings.get(i));
}
}
}
}
}