So the program looks like it displays the desired output, but for some reason(that i can't figure out) it doesn't pass testing?
Could you let me know what the problem is here?
Thanks you
package com.codegym.task.task07.task0709;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Expressing ourselves more concisely
*/
public class Solution {
private static int min;
public static void main(String[] args) throws Exception {
//write your code here
ArrayList<String> words = new ArrayList<String>();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 5; i++){
String s = input.readLine();
words.add(s);
min = words.get(0).length();
if ( min > words.get(i).length())
min = words.get(i).length();
}
for (int i = 0; i < words.size(); i++){
if (words.get(i).length() == min){
System.out.println(words.get(i));
}
}
}
}