Even using the web compiler, and the two long words are displayed, the tasks is still not passing. Any ideas? Thanks
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 = new ArrayList<>();
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int longestString = 0;
for (int i = 0; i < 5; i++) {
strings.add(reader.readLine());
}
for (int i = 0; i < strings.size(); i++) {
if (strings.get(i).length() > longestString)
longestString = strings.get(i).length();
}
for (int i = 0; i < strings.size(); i++) {
if (strings.get(i).length() == longestString)
System.out.println(strings.get(i));
}
}
}