Write a program called Q1.java. It should prompt for and then read from standard input (the keyboard) a sequence of whitespace separated strings. It should output the words one per line, sorted in descending order, and without duplicates (i.e. the 2nd or further instances of the same word are not shown). Before outputting the words, the program should write a short dashed line ("----------") to visually separate output from input - see the sample output below.
Hint: see java.util.TreeSetThe output should conform to that in the sample run of a correct program shown below. Note that, in the sample run, the % sign is not part of the program output.
% % java Q1 Enter a sequence of strings separated by whitespace: all the world is a stage and all the people merely players ---------- world the stage players people merely is and all a %
Here (again) are the common APIs that you may access:
Here is the command to submit your work
(further details regarding the submit command can also be
obtained by
typing man submit
Once again, you are encouraged to submit
regularly.
Newer submissions overwrite older ones.
submit 1020 labtest3W5 Q1.java