any ideas?
package com.codegym.task.task07.task0712;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
Shortest or longest
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> strs = new ArrayList<String>();
for(int i = 0; i < 10; i++) {
strs.add(in.readLine());
}
int short_index = 0;
int long_index = 0;
int shortest = Integer.MAX_VALUE;
int longest = Integer.MIN_VALUE;
String s = "";
String l = "";
for(int i = 0; i < 10; i++) {
String str = (String) strs.get(i);
if (str.length() > longest) {
longest = str.length();
long_index = i;
l = str;
}
else if(str.length() < shortest) {
shortest = str.length();
short_index = i;
s = str;
}
}
if(short_index < long_index)
System.out.println(s);
else
System.out.println(l);
}
}