Decimal “XOR” operator Many programming language provide operators for manipulating the binary (base-2) digits of integers.  Here is one way to generalize these operators to other bases:

Let x and y be single-digit numbers in base B.  Define the unary operator ~ and binary operators &amp;, |, and ^ such that:


~x = (B - 1) - x
x &amp; y = min(x, y)
x | y = max(x, y)
x ^ y = (x &amp; ~y) | (y &amp; ~x)


Note that if B=2, we get the familiar bitwise NOT, AND, OR, and XOR operators.

For B=10, we get the &ldquo;decimal XOR&rdquo; table:

^ │ 0 1 2 3 4 5 6 7 8 9
──┼────────────────────
0 │ 0 1 2 3 4 5 6 7 8 9
1 │ 1 1 2 3 4 5 6 7 8 8
2 │ 2 2 2 3 4 5 6 7 7 7
3 │ 3 3 3 3 4 5 6 6 6 6
4 │ 4 4 4 4 4 5 5 5 5 5
5 │ 5 5 5 5 5 4 4 4 4 4
6 │ 6 6 6 6 5 4 3 3 3 3
7 │ 7 7 7 6 5 4 3 2 2 2
8 │ 8 8 7 6 5 4 3 2 1 1
9 │ 9 8 7 6 5 4 3 2 1 0


For multi-digit numbers, apply the single-digit operator digit-by-digit.  For example, 12345 ^ 24680 = 24655, because:


1 ^ 2 = 2
2 ^ 4 = 4
3 ^ 6 = 6
4 ^ 8 = 5
5 ^ 0 = 5


If the operands are different lengths, then pad the shorter one with leading zeros.

The challenge

Write, in as few bytes as possible, a program or function that takes as input two integers (which may be assumed to be between 0 and 999 999 999, inclusive) and outputs the &ldquo;decimal XOR&rdquo; of the two numbers as defined above.

Test cases


12345, 24680 &rarr; 24655
12345, 6789 &rarr; 16654
2019, 5779 &rarr; 5770
0, 999999999 &rarr; 999999999
0, 0 &rarr; 0
Jelly, 14 bytes

DUz0«9_ṚƊṀƊ€UḌ


Try it online!

Grid of all single digit pairs

A monadic link taking a list of two integers as its argument and returning an integer. 

Explanation

D               | Decimal digits
 U              | Reverse order of each set of digits
  z0            | Transpose with 0 as filler
          Ɗ€    | For each pair of digits, do the following as a monad:
    «   Ɗ       | - Minimum of the two digits and the following as a monad (vectorises):
     9_         |   - 9 minus the digits
       Ṛ        |   - Reverse the order
         Ṁ      | - Maximum
            U   | Reverse the order of the answer to restore the orignal order of digits
             Ḍ  | Convert back from decimal digits to integer


If a digit matrix is acceptable input/output:

Jelly, 12 bytes

Uz0«9_ṚƊṀƊ€U


Try it online!