#P318. 练54.1 6084问题
练54.1 6084问题
Description
Given any four-digit number, rearrange its digits to form the largest and smallest possible four-digit numbers, and calculate the difference between them.
For example: For the number , you can form and , and the difference is .
Input Format
A four-digit number.
Output Format
The difference as described in the problem.
Sample
37216084