You are given a positive integer num consisting of exactly four digits. Split num into two new integers new1 and new2 by using the digits found in num. Leading zeros are allowed in new1 and new2, and all the digits found in num must be used.


	For example, given num = 2932, you have the following digits: two 2's, one 9 and one 3. Some of the possible pairs [new1, new2] are [22, 93], [23, 92], [223, 9] and [2, 329].


Return the minimum possible sum of new1 and new2.

&nbsp;
Example 1:

Input: num = 2932
Output: 52
Explanation: Some possible pairs [new1, new2] are [29, 23], [223, 9], etc.
The minimum sum can be obtained by the pair [29, 23]: 29 + 23 = 52.


Example 2:

Input: num = 4009
Output: 13
Explanation: Some possible pairs [new1, new2] are [0, 49], [490, 0], etc. 
The minimum sum can be obtained by the pair [4, 9]: 4 + 9 = 13.


&nbsp;
Constraints:


	1000 &lt;= num &lt;= 9999


class Solution:
    def minimumSum(self, num: int) -> int:
        s=list(str(num))
        s.sort()
        return int(s[0]+s[2])+int(s[1]+s[3])
class Solution
{
    public int minimumSum(int num)
    {
        int[] dig = new int[4]; // For each digit
        int cur = 0;
        while(num > 0) // Getting each digit
        {
            dig[cur++] = num % 10;
            num /= 10;
        }
        Arrays.sort(dig); // Ascending order
        int num1 = dig[0] * 10 + dig[2]; // 1st and 3rd digit
        int num2 = dig[1] * 10 + dig[3]; // 2nd and 4th digit
        return num1 + num2;
    }
}
class Solution{
public:
    int minimumSum(int num){
        string s = to_string(num);
        sort(s.begin(), s.end());
        int res = (s[0] - '0' + s[1] - '0') * 10 + s[2] - '0' + s[3] - '0';
        return res;
    }
};
var minimumSum = function(num) {
   let numbers = []
    for(let i = 0; i<4; i++){
        numbers.push(~~num % 10)
        num /= 10
    }
    const sorted = numbers.sort((a,b) => b - a)
    return sorted[0] + sorted[1] + (10 *( sorted[2] + sorted[3]))
};
Minimum Sum of Four Digit Number After Splitting Digits