Advanced Java questions -4

A program which will accept three sentences (one sentence per line) and print the words having Initial Caps within the sentences. Below is an example. Here is an example. If the below three sentences are given to the program as input, This is a Program Coding test of Initial Caps the program Will Test You Then, the output would look like: This Program Coding Initial Caps Will Test You Solution: Pattern p = Pattern.compile("^[A-Z]");