First solution to the codewars ranking kata