Append commented solution from codewars.