2002 Programming Contest

Results

Nine teams from various schools in Idaho participated in the sixth High School programming contest.  A total of 25 students participated in the contest.

The first place team was from Centennial High School. The team members were Kelv Cutler Steven Madsen, Stephen Longmuir. They were able to solve all three problems correctly! The second place team was from Eagle High School. The team members were Nathan McIntyre, Scott Carter, Stephen Sledjieski. The third team was from Centennial High School. The team members were Nalin Ratnayake, Michael Owen. All teams finished at least one program correctly.

The Problems

Here are the problems used in the competition.
 
 
 
 


Problem 1: Word Chain

Description: A Word Chain is a sequence of words which differ by one letter. The
following sequence is a word chain

MOM MOP MAP TAP TOP TOW

because each adjacent word differs by exactly one letter.

Write a program that  accepts a sequence of words and tests whether it is word chain. Assume that each sequence is terminated by a special word named END. {\it The word END is not part of the sequence}. Some test sequences are: HEAL, HEAD, DEAD, DEED, DEER, BEER, END and the sequence TWO, TOO, TOP, PIP, POP, END. After reading a  sequence print whether it is or is not a word chain.
 
 

Examples:

Input:
MOM MOP MAP TAP TOP TOW END

Output:
is a word chain.

Input:
TWO TOO TOP PIP POP END

Output:
is not a word chain.


Problem 2: Circular Numbers


Description:   A whole number is said to be circular if, when you multiply the number by its units decimal digit, the result is the number with its decimal digits rotated to the right, where the units digit becoming its high-order digit. For example, 11111 is a circular number because of the multiplication:

11111
       x1
--------
11111
 

Write a program to test if a given number is a circular number. You may assume
that the given number is in the range 0 through 2,000,000,000.
 
 

Examples:

Input:
123456

Output:
123456 is not a circular number

Input:
11111

Output:
11111 is a circular number
 
 


Problem 3: Phoney Programming


Description: A standard telephone has both numbers and letters on its keys. Each of
the ten number keys has the letters associated as follows:

1,0: Have no corresponding letters
2:   A B C
3:   D E F
4:   G H I
5:   J K L
6:   M N O
7:   P R S
8:   T U V
9:   W X Y

If the last four digits of the phone number contains a 0 or a 1 then your program does nothing. Otherwise, it checks all the permutations formed from the letters represented by the corresponding numbers of the last four digits of the phone number against an English dictionary and then prints out all the permutations that were found in the dictionary.

For the competition, an English dictionary is available at /usr/share/dict/words. It contains 45424 words, one per line. Your program should use this dictionary.
 

Example:

Input:
3332665

Output:
amok
book
cook
cool

Input:
3450147

Output:
Sorry, the phone number contains 0 or 1 in the last 4 digits.