I want the folowing program to take user input, store it in the array then repeat it back when the user types `stop`.

However it prints out the rest of the values upto 100 as `null`, this is what I need to remove. I've tried a few different methods but it's just not working for me.

This is basically what I've got so far (with help from other questions on Stack):

```
public static void main(String[] args) {

    String[] teams = new String[100];
    String str = null;
    Scanner sc = new Scanner(System.in);
    int count = -1;
    String[] refinedArray = new String[teams.length];

    for (int i = 0; i < 100; i++) {       
       str= sc.nextLine();

       for(String s : teams) {
           if(s != null) { // Skips over null values. Add "|| "".equals(s)" if you want to exclude empty strings
               refinedArray[++count] = s; // Increments count and sets a value in the refined array
           }
       }

       if(str.equals("stop")) {
          Arrays.stream(teams).forEach(System.out::println);
       }

       teams[i] = str;
    }
}

```