University of Calgary

The Printer's Problem

Printers Problem
source: programming contest


In 1950 (before computers were used for this), a printer had an order for 10,000 bill forms per month, but each month the name of the particular month had to be altered: that is, he printed 10,000 "JANUARY", 10,000 "FEBRUARY", 10,000 "MARCH", etc; but as the particular types with which these words were to be printed were expensive, he only purchased just enough movable types to enable him, by interchanging them, to print in turn the whole of the months of the year.
 
Question: How many separate types did he purchase?
 
Write a program that solves the general case: given a list of strings, what is the minimum number of letters required to be able to print each string in turn?
 
For example: mom, dad, adam would require: a,a,d,d,m,m,o



Updated: August 9, 2005 10:19 PM