DWITE Online Computer Programming Contest

December 2008

Problem 3

Unicorns and Teaspoons

Google's calculator works with some pretty weird units of measure. Have you tried searching for a value of the answer to life the universe and everything / number of horns on a unicorn? (*btw*, it's 42) We'll try to work with just the *imperial units of volume* for now.

You'll need this table of conversions:

5 fluid ounce (oz) | 1 gill (gill) |

4 gill (gill) | 1 pint (pt) |

2 pint (pt) | 1 quart (qt) |

4 quart (qt) | 1 gallon (gal) |

The input file **DATA3.txt** will contain 5 lines in a format of: **value unit1 in unit2**, where the goal is to convert from unit1 to unit2, for a given value. 1 <= value <= 1000. Units are expressed as keys inside brackets in the table above.

The output file **OUT3.txt** will contain 5 integers -- the converted values. The supplied input will always work out to be an integer answer.

Sample Input:

10 oz in gill 20 oz in pt 2 gal in oz 1 gal in qt 2 pt in pt

Sample Output:

2 1 320 4 2