CPS 104 Problem P4
Histogram in Spim
Using SPIM, write a complete program which takes its input from stdin (the default), and performs the following task:
The input will contain arbitrary characters and will end with the line 000. Each line, including the terminating 000 line, will end with a newline. Read this text, and print a histogram of the letters which occur in it. Your program may ignore any characters after the 256th character on any one line. Map upper and lower case letters to lower-case, and ignore any other characters. The output should be a sequence of 26 lines, in alphabetical order:
a N(a)
b N(b)
...
z N(z)
where N( letter ) is the number of times letter appears in the text, in either upper or lower case. Each line of output should consist of one lower-case letter, a single TAB ('\t') character, and the value of N( letter ), in decimal. The text may be arbitrarily long (that is, it may contain a large number of lines). No individual letter will appear more than 2**31-1 times.
The input text may contain any character readable by getchar().