Q:

How to turn user input into an array

I'd like to turn user input into a string array, and then edit that array for key words to change them, however I don't know how to do this and immediately ran into problems of trying to solve how to code this without an array going out of bounds. 
The only code I have is this:
import java.util.*;

class FilterTest{ 

    public static void main (String[] args){
        Scanner scan = new Scanner (System.in);
        //String[] inputMessage = new String (); I don't know how to do the length here.
        input.nextString();
        inputMessage=input.nextString;
    }
}

A:

Here's an example with an ArrayList.
public static void main(String[] args) {
    ArrayList<String> inputMessage = new ArrayList<String>();

    Scanner sc = new Scanner(System.in);
    while (true) {
        inputMessage.add(sc.next());
    }
}

