I think I've tried everything and it still doesn't work that is wrong in my code?
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;
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
strings = new ArrayList<String>();
ArrayList <String> haber= new ArrayList<String>();
for (int i = 0; i < 5; i++){
strings.add(reader.readLine());
}
int a = strings.get(0).length();
String b = strings.get(0);
for (int i = 0; i < strings.size(); i++){
if (strings.get(i).length() > a ){
b = strings.get(i);
a = strings.get(i).length();
}
else if (strings.get(i).length() < a) {
b = b;
a = a;
}
else if (strings.get(i).length() == a){
haber.add(strings.get(i));
a = a;
}
}
if (a > haber.get(0).length()){
System.out.println(b);
}
else{
for (int i = 0; i < haber.size();i++){
System.out.println(haber.get(i));
}
}
//write your code here
}
}