Глаз уже откровенно замылен, ошибки в упор не вижу..
Подскажите, где косяк..
package com.javarush.task.task07.task0708;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
/*
Самая длинная строка
*/
public class Solution {
private static List<String> strings = new ArrayList<String>();
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int max = 0;
String maxi = null;
for(int x = 0; x < 5; x++){
strings.add(sc.nextLine());
}
for(int x = 0; x<5; x++){
if(strings.get(x).length() > max) {
max = strings.get(x).length();
maxi = strings.get(x);
strings.remove(strings.get(x));
strings.add(maxi);
}
}
for(int a = 0; a<4; a++){
if(strings.get(a).length() == max){
System.out.println(strings.get(a));
}
}
System.out.println(maxi);
}
}