        // A test-rig for the LineFill class.
        // Read words until STOP is read. Output lines
        // with a maximum length of lineWidth characters.
class LineFillMain {
    public static void main(String[] args){
        final int lineWidth = 40;
        final String terminator = "STOP";
        LineFill formatter = new LineFill(lineWidth);
        SimpleInput reader = new SimpleInput();

        System.out.println("Type words to be formatted, "+lineWidth+
                           " characters per line. Type "+terminator+
                           " to stop input.");
        String word = reader.nextWord();
        while(!word.equals(terminator)){
            formatter.addWord(word);
            word = reader.nextWord();
        }
        formatter.flush();
    }
}
