Correct solution to TryoutProblemB. Unsuccessful (and messy) attempt at TryoutProblemC.