s = input()
cnt = {chr(ord("A") + i): 0 for i in range(18)}
for c in s:
    cnt[c] += 1

letters = sorted(cnt.keys(), key=lambda c: cnt[c])

middle_freq = (cnt[letters[8]] + cnt[letters[9]]) / 2

one_digit = {c for c in letters if cnt[c] > middle_freq}
two_digits = {c for c in letters if cnt[c] < middle_freq}

cnt_free_one_digit = 9 - len(one_digit)
cnt_free_two_digits =  9 - len(two_digits)

min1 = 1
min2 = 10

cipher = dict()
ans = ""
for c in s:
    if c not in cipher:
        if c in one_digit:
            cipher[c] = str(min1)
            min1 += 1
        elif c in two_digits:
            cipher[c] = str(min2)
            min2 += 10
        elif cnt_free_two_digits == 0 or cnt_free_one_digit and min1 < min2 / 10:
            cipher[c] = str(min1)
            min1 += 1
            cnt_free_one_digit -= 1
        else:
            cipher[c] = str(min2)
            min2 += 10
            cnt_free_two_digits -= 1
    ans += cipher[c]

print(ans)
