manually when i compile it ,code seems to fine ,where is the mistake
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
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
int lng=0;
int shrt=0;
for(int i=0;i<10;i++){
String s = reader.readLine();
list.add(s);
}
String temp =list.get(0);
for(int j=1;j<5;j++){
if(list.get(j).length()<temp.length()){
temp=list.get(j);
shrt=j;
}
}
String temp1=list.get(0);
for(int j=1;j<5;j++){
if(list.get(j).length()>temp1.length()){
temp1=list.get(j);
lng=j;
}
if(shrt<lng){
System.out.println(list.get(shrt));
}
else
System.out.println(list.get(lng));
}
}
}