Sometimes the hardest part is figuring out the requuirements
For requirement #1 I used
List<String> listOfStrings = new ArrayList<String>();
codegym.cc rejected that
I will try changing to
ArrayList<String> listOfStrings = new ArrayList<String>();
package com.codegym.task.task07.task0709;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/*
Expressing ourselves more concisely
*/
public class Solution {
public static void main(String[] args) throws Exception {
//write your code here
InputStream inputStream = System.in;
Reader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
List<String> listOfStrings = new ArrayList<String>();
for(int i=0; i<5; i++){
listOfStrings.add(bufferedReader.readLine());
}
int minStringLength=listOfStrings.get(0).length();
for(int i =1; i<listOfStrings.size(); i++){
if(listOfStrings.get(i).length()<minStringLength){
minStringLength=listOfStrings.get(i).length();
}
}
for(int i=0; i<listOfStrings.size(); i++){
if(listOfStrings.get(i).length()==minStringLength){
System.out.println(listOfStrings.get(i));
}
}
}
}