public class Solution { private static ArrayList<String> strings; static int c_len = 0, o_len = 0; public static void main(String[] args) throws Exception { strings = new ArrayList<>(); ArrayList<Integer> index = new ArrayList<>(); for (int i = 0; i < 5; i++) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); strings.add(br.readLine()); } for ( int i = 0; i < strings.size(); i++){ c_len = strings.get(i).length(); if ( c_len > o_len ){ o_len = c_len; index.clear(); index.add(i); } else if(c_len == o_len){ index.add(i); } } for ( int j = 0; j < index.size(); j++){ System.out.println(strings.get(index.get(j))); } } }