Solution to CodeEval's Juggle Fest Challenge