Please help.....
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 {
//write your code here
ArrayList<String> strings = new ArrayList<String>();
for (int i =0; i<10; i++){
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
strings.add(reader.readLine());
}
int longest = strings.get(0).length();
int shortest = strings.get(0).length();
ArrayList<Integer> positionL = new ArrayList<>();
ArrayList<Integer> positionS = new ArrayList<>();
for (int i =1; i<strings.size(); i++){
if (strings.get(i).length() > longest ) {
longest = strings.get(i).length();
}
}
for (int i =1; i<strings.size(); i++){
if (strings.get(i).length() < shortest ) {
shortest = strings.get(i).length();
}
}
for (int i =0; i<strings.size(); i++){
if(strings.get(i).length() == longest){
positionL.add(i);
}
if(strings.get(i).length() == shortest){
positionS.add(i);
}
}
//System.out.println(positionL.get(0));
//System.out.println(positionS.get(0));
if (positionL.get(0) < positionS.get(0)){
System.out.println(positionL.get(0));
}
if (positionS.get(0) < positionL.get(0)){
System.out.println(positionS.get(0));
}
}
}