The third condition on my task isn't fulfilled. The output is correct though. What's wrong
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 bis = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
list.add(bis.readLine());
}
String Max = list.get(0);
String Min = list.get(0);
int Maxchar = 0;
int Minchar = 10;
for (int i = 0; i < 10; i++) {
if (list.get(i).length() > Max.length()) {
Max = list.get(i);
Maxchar = i;
}
}
for (int s = 0; s < 10; s++) {
if (list.get(s).length() < Min.length()) {
Min = list.get(s);
Minchar = s;
}
}
int blob = Maxchar;
int bleb = Minchar;
if (blob < bleb) {
System.out.println(list.get(blob));
}
else {
System.out.println(list.get(bleb));
}
}
}