Compute a child height range from both parents' heights and the child sex, then round both ends inward to whole inches.
Easy2ImplementationMathNo attempts yetTime limit5sMemory limit512 MBDr. Spaceman built an algorithm that takes the heights of both parents and reports the range a child's adult height falls into. The steps are:
When parents ask about their child's height, Dr. Spaceman answers with that minimum and that maximum. One foot is 12 inches.
The first line holds the number of test cases T. Then T lines follow.
Each line holds one letter, a space, the mother's height, a space, and the father's height, in that order. The letter B means a boy and G means a girl.
A height is written as feet, an apostrophe, inches, and a double quote. For example, 5'11" is 5 feet 11 inches. The feet value is a positive integer and the inch value is a non-negative integer.
For each test case, print one line in the form Case #x: A to B. Here x is the case number starting at 1, and A and B are the minimum and the maximum height that Dr. Spaceman's algorithm produces. Write both in the same feet, apostrophe, inches, double quote format used by the input.
When the middle value is not a whole number of inches, shrink both ends of the range inward so that they become integers. The minimum rounds up and the maximum rounds down.
Unlike the input, the printed feet value is sometimes 0 or 10.