Surprisingly it works, but not how it should be...right?
it ran and display the line of the strings on a new line lol
package com.codegym.task.task07.task0708;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Longest string
*/
public class Solution {
private static List<String> strings = new <String>ArrayList(); ;
public static void main(String[] args) throws Exception {
//write your code here
int random = 0;
int set = 0;
String longest;
String use = "";
String done = " ";
BufferedReader cool = new BufferedReader(new InputStreamReader(System.in));
for (int i = 0; i < 5; i++){
strings.add(cool.readLine());
}
for (int i = 0; i < strings.size(); i++){
longest = strings.get(i);
set = longest.compareToIgnoreCase(use);
if (random < set){
random = set;
done += strings.get(i);
} else if (random == set){
done = done + "\n " + strings.get(i);
}
}
System.out.println(done);
}
}