A and B are numbers from 0 to 9. When the five-digit number A835B is divisible by 12, find the difference between the largest number and the smallest number that can be made from A835B.
A835B [OP_GEN_POSSIBLE_LIST] 12 [OP_LIST_DIVISIBLE] 1 [OP_LIST_MAX] 1 [OP_LIST_MIN] [OP_SUB]
var_a = 'A835B'
ans_dict = dict()
var_a = str(var_a)
list_a = []
variable_candi = set(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'])
for v in set(var_a):
    if v in variable_candi:
        ans_dict[v] = 0
candi = list(itertools.product('0123456789', repeat=len(ans_dict)))
for c in candi:
    temp = var_a
    for i, (k, _) in enumerate(ans_dict.items()):
        temp = temp.replace(k, str(c[i]))
    if len(var_a) == len(str(int(temp))):
        new_elem = int(temp)
        list_a.append(new_elem)
var_b = 12
list_b = []
var_b = int(var_b)
for i in list_a:
    i = int(i)
    if i % var_b == 0:
        list_b.append(i)
var_c = 1
list_c=list_b.copy()
list_c.sort()
var_d = list_c[-var_c]
var_e = 1
list_d=list_b.copy()
list_d.sort()
var_f = list_d[var_e-1]
var_g = var_d - var_f
print(int(var_g))