public class StringEntry {
        public static void main(String[] args) throws IOException {
            BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

            // initialize and ArrayList
            ArrayList<String> stringList = new ArrayList<String>();

            while (!reader.readLine().equals("end"));  // <--------------------THIS IS WHERE THE ERROR IS OCCURING
            {
                stringList.add(reader.readLine());
            }

            for (int i = 0; i < stringList.size(); i++)
            {
                System.out.println(stringList.get(i));
            }
            //write your code here
        }
    }
This code sort of works. In IntelliJ it allows the code to execute but when printing out the string it skips every other word and you need to enter end twice to end the program. I also got this error when I try it on the website java.lang.NullPointerException at com.codegym.task.task07.task0722.Solution.main(Solution.java:20)