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 { ArrayList<String> list = new ArrayList<String>(); Scanner sc = new Scanner(System.in); for (int i = 0; i < 5; i++) { String s = sc.nextLine(); list.add(s); } String shortest = list.get(0); for (String element : list) { if (element.length() < shortest.length()) { shortest = element; } } System.out.println(shortest); } }