The output of my code is not correct. It skips some of the strings and I can't find what the problem is.
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));
//write your code here
ArrayList<String> list = new ArrayList<String>();
while(true)
{
if(!(reader.readLine().equals("end")))
list.add(reader.readLine());
else
break;
}
for(int i=0; i<list.size(); i++)
{
System.out.println(list.get(i));
}
}
}