Can't figure it out. Someone earlier had an empty string in the list, I checked for that. This program doesn't. Any insight?
package com.codegym.task.task07.task0722;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
The end
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
ArrayList<String> list = new ArrayList<String>();
//write your code here
while (true)
{
String s = reader.readLine();
if (s.equals("end"))
break;
list.add(s);
}
for (int i = 0; i < list.size()-1; i++){
System.out.println(list.get(i));
}
}
}