package com.codegym.task.task07.task0722;
//import jdk.internal.joptsimple.internal.Strings;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
/*
The end
1. Declare a string list variable and immediately initialize it.
2. Read strings from the keyboard and add them to a list until the user enters "end".
3. Do not add "end" to the list.
4. Display the list, each value on a new line.
5. Use a for loop.
*/
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>();
Iterator<String> iter = list.iterator();
while(iter.hasNext()){
if(iter.next()=="end"){
break;
}
else {
String s = reader.readLine();
list.add(s);
}
}
for (String l: list) {
System.out.println(l);
}
}
}