PROGRAM #1

FOLLOW THE COMMENT GUIDELINES EXACTLY.

Write a program that uses methods from class String.  The program should read any sentence as one long string and then print out the first four words, if they exist.

 

Example #1:

input>>The moon is made of green cheese.

Program Output

The

moon

is

made

Example #2:

input>>All dogs have a tail.

Program Output

All

dogs

have

a