Solution for sortTheGiftCode