Not sure the issue, i have confirmed 5 strings are being read commented section, but i still don't pass the requirement - everything else passes
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 ArrayList<String> strings = new ArrayList<String>();
public static void main(String[] args) throws Exception {
//write your code here
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> strings = new ArrayList<String>();
ArrayList<String> longest = new ArrayList<String>();
String words;
for(int i = 0; i <= 4; i++)
{
words = reader.readLine();
strings.add(words);
}
/*
for(int i = 0; i <= 4; i++)
{
System.out.println(strings.get(i));
}
*/
int longst = strings.get(0).length();
for(int i = 0; i <= (strings.size()-1); i++)
{
int current = strings.get(i).length();
if (longst <= current)
{
longst = current;
}
}
for(int i = 0; i <= (strings.size()-1); i++)
{
if(strings.get(i).length() == longst)
{
longest.add(strings.get(i));
}
}
for(int i = 0; i <= (longest.size()-1); i++)
{
System.out.println(longest.get(i));
}
}
}