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<>();
        for (int i = 0; i < 3; i++) {
            list.add(reader.readLine());
        }
        //display the shortest or longest
        //we should determine what makes it shortest or longest
        int shortest = list.get(0).length();
        int longest = list.get(0).length();
        for (String value : list) {
            if (value.length() < shortest) {
                shortest = value.length();
            } else if (value.length() > longest) {
                longest = value.length();
            }
        }
        for (String s : list) {
            if (shortest == s.length()) {
                System.out.println(s);
            } else if (longest == s.length()) {
                System.out.println(s);
            }

        }

    }
}
Code is running fine but i`m stuck on displaying only one ...