# Author : Steven Miller # Course Number : 22C:016 SCA # Student ID : 4784653 # Main program - inputs text and prints a distribution of the number of words # beginning with each letter of the alphabet import string distribution = [0]*26 # Initialize distribution for each letter of the alphabet print "Please type your text. Type an extra enter when you are done." line = raw_input() while line: # For each line of text entered for word in line.split() : # For each word in the line i = ord(string.lower(word[0])) - ord('a') # Calculate the index and distribution[i] += 1 # update the distribution line = raw_input() print distribution