DWITE Online Computer Programming Contest

Unicorns and Teaspoons

December 2008
Problem 3

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 the format of: value unit1 in unit2, where the goal is to convert the given value from unit1 to unit2. 1 ≤ value ≤ 1000. The possible units are the strings 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: