Problem #10

Code Wars II
Danger Level: Blue Cruiser

}Word Sorter~

Point Value: 6

Problem Statement

A classic word sort problem with a special bonus!

Program Input

The input file PROB10.IN will contain several lines of text.  For example:

Santa, you just better watch your step!
How much is that doggie in the window?
The quick brown fox jumped over the lazy dog.
Have you read Knuth's programming series?
It just doesn't get any better than this!

Program Output

The program should sort the words on each line and print them to the output file, PROB10.OUT, like this:

better just Santa step watch you your
doggie How in is much that the window
brown dog fox jumped lazy over The the quick
Have Knuth's programming read series you
any better doesn't get It just than this

1 POINT BONUS: Count the number of occurrences of each word in the entire file and print the list at the end of the output file, sorted in alphabetical order.  (Sample output is in columns, yours shouldn't).
any 1
better 2
brown 1
dog 1
doggie 1
doesn't 1
fox 1
get 1
Have 1
How 1
in 1
is 1
It 1
jumped 1
just 2
Knuth's 1
lazy 1
much 1
over 1
programming 1
quick 1
read 1
Santa 1
series 1
step 1
than 1
that 1
the 3
this 1
window 1
watch 1
you 2
your 1