Problem: Yahtzee

Source File:

Input File: PROBLEMB.DAT

Description:

Professor Clueless needs help playing the Yathzee dice game with his daughter. He realizes that there are 5 six sided dice, but after he has rolled them, he can't distinguish a long straight from a full house. Your task is to identify the best use of each group of five dice values in the input.

The input will consist of groups of five dice values where each die has the integer value 1 to 6 inclusive. You should ignore values that are outside that range (with a message stating you are ignoring it). Continue reading groups of 5 dice values until an attempt to read an integer fails. For each group of dice, print the best use of that group of dice.

Possible uses listed from best to worst are:

Please note, the words in bold are to be printed along with the value described. Only the highest score should be printed. With two pair, the higher value should be printed first. With a full house, the number occurring three times should be printed first.

Sample Input Sample Output
4 5 3 6 4short straight: 3 4 5 6
6 3 2 3 2 two pair: 3 2
3 2 3 2 3 full house: 3 2
6 3 1 2 5 nothing
1 1 1 1 4 four of a kind: 1
2 8 5 2 5 5 Invalid 8, ignored. full house: 5 2


This problem was from the Spring 1997 PACISE contest at Clarion University