Calculate the difference between the ``maximum integer value'' and the ``minimum integer value'' that can be obtained by rearranging the numbers of each digit for a positive integer value of 4 digits or less to create the next integer value. For example, the maximum integer value obtained by rearranging the digits of ``5138'' is ``8531'', the minimum integer value is ``1358'', and the difference between them is ``7173''. The next integer value will be "7173". Similarly, in the case of ``21'', the thousands and hundreds digits are considered to be ``0'' (which is ``0021''), and the maximum integer value that can be obtained by rearranging the numbers of each digit is ``2100'', and the smallest The integer value is ``12'' and the difference between them is ``2088'', so the next integer value for ``21'' is ``2088''. For a positive integer value of 4 digits or less, if you repeat the operation to create the next integer value by calculating the difference between the "maximum integer value" and the "minimum integer value" that can be obtained by rearranging the numbers of each digit , always converges to some integer value. Enter a positive integer value n of 4 or fewer digits in the command line input. Create a program that repeats the above calculation and outputs the integer values until convergence to the standard output.

`def rearrange(n): num_list = list(str(n)) max_num = int("".join(sorted(num_list, reverse=True))) min_num = int("".join(sorted(num_list))) diff = max_num - min_num print(diff) return diff def main(): n = int(input("Enter a positive integer value of 4 digits or less: ")) next_int = rearrange(n) while True: if next_int == 6174: break else: next_int = rearrange(next_int)`