num to a string to easily access individual digits.evens and odds, to store even and odd digits respectively.evens and odds lists in descending order.result to store the digits of the final number.result.result to form a string and convert it back to an integer.