My solution to SK planet Code Sprint 2013 Round 2