public class Solution {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
ArrayList <String> strings = new ArrayList<String>();
strings.add(scan.nextLine());
strings.add(scan.nextLine());
strings.add(scan.nextLine());
strings.add(scan.nextLine());
strings.add(scan.nextLine());
int min = 0;
for (int i = 0; i < strings.size()-1; i++) {
if (strings.get(i).length() > strings.get(i+1).length()) {
min = i+1;
}
}
for (int i = 0; i < strings.size(); i++) {
if (strings.get(i).length() == strings.get(min).length()) {
System.out.println(strings.get(i));
}
}
}
}
package com.codegym.task.task07.task0709;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Scanner;
/*
Expressing ourselves more concisely
*/
public class Solution {
public static void main(String[] args) throws Exception {
Scanner scan = new Scanner(System.in);
ArrayList <String> strings = new ArrayList<String>();
strings.add(scan.nextLine());
strings.add(scan.nextLine());
strings.add(scan.nextLine());
strings.add(scan.nextLine());
strings.add(scan.nextLine());
int min = 0;
for (int i = 0; i < strings.size()-1; i++) {
if (strings.get(i).length() > strings.get(i+1).length()) {
min = i+1;
}
}
for (int i = 0; i < strings.size(); i++) {
if (strings.get(i).length() == strings.get(min).length()) {
System.out.println(strings.get(i));
}
}
}
}