//What is wrong with the following solution for all your base problem

HELP!!!

def toDigits_(s):

# import ipdb; ipdb.set_trace()

if (len(s)) < 3:

return “10”

nl = []

countval = {}

if s[0].isnumeric():

nl.append(s[0])

else:

nl.append(1)

if not s[1].isnumeric():

nl.append(0)

else:

nl.append(s[1])

i = 2

c = 2

while i < len(s):

if s[i].isnumeric():

nl.append(s[i])

else:

if s[i] in countval:

nl.append(countval[s[i]])

else:

countval[s[i]] = c

nl.append(countval[s[i]])

c = c+1

i = i+1

return “”.join(str(el) for el in nl)

def calcVal(s):

val = 0

# import ipdb; ipdb.set_trace()

base = int(max(s)) + 1

for i in range(len(s)):

# print(s[i])

val = val + int(s[i])*(base ** (len(s)-1-i))

return val

def main():

t = int(input())

for i in range(t):

input_str = input()

val = calcVal(toDigits_(input_str))

print(f"Case #{i+1}: {val}")

main()