Senior Division 1984
1.  WORD DIAMONDS
WORD DIAMONDS look like
              
         E
        N N
       C   C
      O     O
     D       D
    E         E  
     N       N
      C     C
       O   O
        D D 
         E

Any word that begins and ends with the same letter can be made into a 
WORD DIAMOND.  Write a program that will print out WORD 
DIAMONDS for any word up to 8 letters long that begins and ends 
with the same letter.  Your program should ask the user to enter a 
word, check that it satisfies the given properties, and print out the 
WORD DIAMONDS.

Test your program with the following words:  NOON, ROOT, 
ELLIPSE

Sample Run

ENTER A WORD: NOON
         
     N
    O O
   O   O
  N     N 
   O   O 
    O O
     N

2.  SPORT OF KINGS
Man o' War and Swaps, two great horses from racing history, are back 
again to race each other for all the roses.  Your job is to write a 
program that will simulate the greatest horse race of all time.  Here are 
the rules.
1.  The track is 1000 yards in length.The winner is the first horse to 
travel 1000 yards or more.
2. Man o' War advances X yards while Swaps advances Y yards 
according to the rules:
 
 1. X = 9 * Y + 11 - 64 * (INT (( 9 * Y + 11) / 64)) 
 2. Y = 9* X +12 - 64 * ( INT (( 9 * X + 12 ) / 64 ))

3.  To begin the race, a seed number is chosen for Y.  This seed 
number is used to compute Man o' War's  first advancement X using 
rule 1.  The resulting X value is used to compute Swap's first 
advancement Y according to rule 2.  The resulting Y value is used to 
compute Man o' War's second advancement X according to rule 1.  
The resulting X value is used to compute Swaps' second advancement 
Y.   And on and on and on until the race is over.  A race is a draw if 
they both exceed 1000 yards at the same stage.

4.  Races are run until one horse has won three times.  The seed 
number used for a race is the race number 1, 2, 3, 4, 5, 6 . . . .  
respectively.

Write a program that simulates each race according to the above rules.  
Compute the winner of each race (or indicate a draw) and announce 
the greatest horse of all time -- the one that wins three races first.

Sample run
SPORT OF KINGS
Race		Winner
1		MAN O'WAR
2		SWAPS
3		MAN O' WAR
4		SWAPS
5		DRAW
6		MAN O'WAR		
		.		.
THE GREATEST HORSE OF ALL TIME IS
MAN O'WAR


3.  KRUNCH
When you KRUNCH the word MISSISSIPPI you get  MSSSSPP.  This 
is the name of the MISSISSIPPI river after all of the I's are 'krunched' 
out of it.  A phrase can be krunched too !
        RLRD CRSSNG

is the krunched version of 

       RAILROAD CROSSING

where all the vowels A, I, and O have been krunched out.

Write a program that will KRUNCH any string of characters supplied 
by the user out of any phrase (up to 60 characters long).  If all the 
letters in a word are krunched out, then a space should also be 
removed so that double spaces do not appear between words in the 
output.

KRUNCH the the phrases:

RAILROAD CROSSING WITHOUT ANY RS
(remove all R's and S's)

KRUNCH A BUNCH OF MUNCHIES FOR LUNCH
(remove all vowels AEIOUY)

Sample Run
ENTER A PHRASE: RAILROAD CROSSING WITHOUT ANY RS

AILOAD COING WITHOUT ANY 

4. WORLD SERIES
In the World Series of Baseball two teams play each other until one 
team has won the majority of the games.  In a seven game series, this 
is accomplished when one team has won four games.  There must be at 
least four games played in a world series and it can last up to seven 
games.  A World Series is called a 'BEST of 7' World Series if 7 is the 
most games that can be played. 

How many ways can a 'BEST OF N'-Game World Series be played? (N 
is an odd integer from 1 to 9).  

A loss is indicated L and a win is denoted with a W.

Write a program that will generate a complete listing of all 'BEST OF 
N' World Series as shown in the sample run. The program must work 
for any value of N from 1 to 9.

Test your program for N=5 and N=7.

Sample Run

ENTER A VALUE FOR THE N IN THE BEST OF N WORLD 
SERIES: 3

POSSIBLE OUTCOMES OF A BEST OF 3 GAME WORLD SERIES 
IS:

     GAME
1	2	3	SERIES
=====================
L	L		L
L	W	L	L
L	W	W	W
W	L	L	L
W	L	W	W
W	W		W
=====================
TOTAL POSSIBLE SERIES IS 6

5. WELL ORDERED WORDS

The word ACT is WELL-ORDERED because the letters in the word 
(A, C, T) are in alphabetical order left to right.  The word ATE is not 
well-ordered 

Write a program that will find and display all possible WELL-
ORDERED words of length N that can be chosen from a given set of 
letters.  Compute the total number of WELL-ORDERED words 
generated.  Display the words in alphabetical order.  

(For this problem, a word is any combination of letters.)

Test your program with the letters in the word COMPUTER with word 
size 3 and in the letters in the word PROBLEMS with word size  6.

Sample Run

ENTER A SET OF LETTERS:  COMPUTER
ENTER A WORD LENGTH: 3

THE WELL ORDERED WORDS OF LENGTH 3 THAT CAN BE 
FORMED FROM THE LETTERS IN THE SET (COMPUTER) ARE:
	
CEM CEO CEP CER CET CEU.CMO CMP
CMR CMT CMU COP COR COT COU CPR
CPT CPU CRT CRU CTU EMO EMP EMR
EMT EMU EOP EOR EOT EOU EPR EPT
EPU ERT ERU ETU MOP MOR MOT MOU
MPR MPT MPU MRT MRU MTU OPR OPT
OPU ORT ORU OTU PRT PRU PTU RTU

THE TOTAL NUMBER IS 56.
                                ICPSC 1984
                        Senior Division Problems




