ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string has length strictly less than 26, no such substring exists and thus it is not nice.

Now, ZS the Coder tells you a word, where some of its letters are missing as he forgot them. He wants to determine if it is possible to fill in the missing letters so that the resulting word is nice. If it is possible, he needs you to find an example of such a word as well. Can you help him?


-----Input-----

The first and only line of the input contains a single string s (1 ≤ |s| ≤ 50 000), the word that ZS the Coder remembers. Each character of the string is the uppercase letter of English alphabet ('A'-'Z') or is a question mark ('?'), where the question marks denotes the letters that ZS the Coder can't remember.


-----Output-----

If there is no way to replace all the question marks with uppercase letters such that the resulting word is nice, then print  - 1 in the only line.

Otherwise, print a string which denotes a possible nice word that ZS the Coder learned. This string should match the string from the input, except for the question marks replaced with uppercase English letters.

If there are multiple solutions, you may print any of them.


-----Examples-----
Input
ABC??FGHIJK???OPQR?TUVWXY?

Output
ABCDEFGHIJKLMNOPQRZTUVWXYS
Input
WELCOMETOCODEFORCESROUNDTHREEHUNDREDANDSEVENTYTWO

Output
-1
Input
??????????????????????????

Output
MNBVCXZLKJHGFDSAQPWOEIRUYT
Input
AABCDEFGHIJKLMNOPQRSTUVW??M

Output
-1


-----Note-----

In the first sample case, ABCDEFGHIJKLMNOPQRZTUVWXYS is a valid answer beacuse it contains a substring of length 26 (the whole string in this case) which contains all the letters of the English alphabet exactly once. Note that there are many possible solutions, such as ABCDEFGHIJKLMNOPQRSTUVWXYZ or ABCEDFGHIJKLMNOPQRZTUVWXYS.

In the second sample case, there are no missing letters. In addition, the given string does not have a substring of length 26 that contains all the letters of the alphabet, so the answer is  - 1.

In the third sample case, any string of length 26 that contains all letters of the English alphabet fits as an answer.

Source: codeforces | Difficulty: EASY
Tags: Amortized analysis

Greedy algorithms


Solutions:
def hello():
	s = list(input())
	l = len(s)
	import string
	upper = list(string.ascii_uppercase)
	copy = upper[:]
	for i in range(l - 25):
		copy = upper[:]
		count = 0
		index = []
		for j in range(i, i + 26):
			if s[j] == '?':
				count += 1
				index.append(j)
			elif s[j] in copy:
				copy.remove(s[j])
			else:
				break
		if count == len(copy):
			for k in range(count):
				s[index[k]] = copy.pop()
			for o in range(l):
				if s[o] == '?':
					s[o] = 'A'
			break
	else:
		print(-1)
		return
	print(''.join(s))
hello()


s = list(input())
s1 = s.copy()
success = False
for i in range(0, len(s) - 25):
	good_substring = True
	for j in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
		if s[i:i + 26].count(j) > 1:
			good_substring = False
	if good_substring == False:
		continue
	for j in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
		counter = s[i:i + 26].count(j)
		if counter == 0:
			if s1[i:i + 26].count('?') != 0:
				s1[s1.index('?', i, i + 26)] = j
		if j == 'Z':
			success = True
	break
if success:
	for i in range(0, len(s1)):
		if s1[i] == '?':
			s1[i] = 'A'
	for i in s1:
		print(i, end='')
else:
	print(-1)


def main():
	(l, cnt) = (list(map(ord, input())), [-1] * 91)
	for c in l[:25]:
		cnt[c] += 1
	(twins, cnt[63]) = (sum((i > 0 for i in cnt[65:])), -27)
	for (i, u, v) in zip(range(50000), l, l[25:]):
		cnt[v] = c = cnt[v] + 1
		if c == 1:
			twins += 1
		elif not twins:
			stuff = [j for j in range(90, 64, -1) if cnt[j]]
			while stuff:
				while l[i] != 63:
					i += 1
				l[i] = stuff.pop()
			return print(''.join(map(chr, l)).replace('?', 'A'))
		cnt[u] = c = cnt[u] - 1
		if not c:
			twins -= 1
	print(-1)
main()


s = list(input())

def is_pretty(s):
	d = {chr(ord('A') + i): 0 for i in range(26)}
	q = 0
	qs = []
	f = 26
	for l in range(len(s)):
		if s[l] == '?':
			q += 1
			qs.append(l)
		elif d[s[l]] == 0:
			f -= 1
			d[s[l]] += 1
		else:
			return ''
	if f == 0:
		return ''.join(s)
	if f - q > 0:
		return ''
	qx = 0
	for l in d.keys():
		if d[l] == 0:
			s[qs[qx]] = l
			qx += 1
	return ''.join(s)
if len(s) < 26:
	print(-1)
elif len(s) == 26:
	if is_pretty(s) != '':
		print(''.join(is_pretty(s)))
	else:
		print(-1)
else:
	ok = False
	for i in range(26, len(s) + 1):
		pretty = is_pretty(s[i - 26:i])
		if len(pretty) != 0:
			s = s[:i - 26] + list(pretty) + s[i:]
			for sl in range(len(s)):
				if s[sl] == '?':
					s[sl] = 'X'
			print(''.join(s))
			ok = True
			break
	if not ok:
		print(-1)


from sys import stdin, stdout
f = list(stdin.readline().strip())
label = False
chars = {'X', 'Y', 'Z', 'T', 'U', 'V', 'W', 'P', 'Q', 'R', 'S', 'L', 'M', 'N', 'O', 'H', 'I', 'J', 'K', 'D', 'E', 'F', 'G', 'A', 'B', 'C'}
if len(f) >= 26:
	for i in range(len(f)):
		if f[i:i + 26].count('?') + len(set(f[i:i + 26]) - {'?'}) == 26:
			label = True
			challengers = set(f[i:i + 26]) - {'?'}
			ind = i
if label:
	for i in range(len(f)):
		if ind + 25 >= i >= ind and f[i] == '?':
			for char in chars:
				if char not in challengers:
					challengers.add(char)
					f[i] = char
					break
		elif f[i] == '?':
			f[i] = 'A'
	stdout.write(''.join(f))
else:
	stdout.write('-1')


from collections import defaultdict
x = list(input())
a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
a = set(list(a))
d = defaultdict(int)
y = set(x[:])
if len(x) < 26:
	print(-1)
else:
	p = []
	f = 0
	r = 0
	for i in range(26):
		d[x[i]] += 1
		if d[x[i]] > 1 and x[i] != '?':
			f = 1
		p.append(x[i])
	z = set(p[:])
	q = a.difference(z)
	if f == 0 and len(q) == d['?']:
		r = 1
		for i in range(26):
			if x[i] == '?':
				for j in q:
					break
				q.remove(j)
				x[i] = j
	if r == 0:
		for i in range(26, len(x)):
			d[p[0]] -= 1
			if d[p[0]] == 0:
				z.remove(p[0])
			p.append(x[i])
			p = p[1:]
			z.add(x[i])
			d[x[i]] += 1
			q = a.difference(z)
			f = 0
			for l in p:
				if d[l] > 1 and l != '?':
					f = 1
					break
			if f == 0 and len(q) == d['?']:
				r = 1
				for j in range(i - 25, i + 1):
					if x[j] == '?':
						for k in q:
							break
						q.remove(k)
						x[j] = k
			if r == 1:
				break
	if r == 1:
		for i in range(len(x)):
			if x[i] == '?':
				x[i] = 'A'
		print(''.join(x))
	else:
		print(-1)


n = [i for i in input()]
alph = {'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M'}
ans = -1

def replace(x, avail):
	avail = list(avail)
	for i in range(26):
		if x[i] == '?':
			x[i] = avail.pop()
	return x

def pad(x):
	for i in range(len(x)):
		if x[i] == '?':
			x[i] = 'A'
	return x
for i in range(len(n) - 25):
	sub = n[i:i + 26]
	qus = sub.count('?')
	if qus == len(alph - set(sub)):
		ans = ''.join(pad(n[:i])) + ''.join(replace(sub, alph - set(sub))) + ''.join(pad(n[i + 26:]))
		break
print(ans)


def sol(s):
	alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	dp = set()
	l = list(s)
	n = len(s)
	(i, j) = (0, 0)
	ans = -1
	while j < n:
		if l[j] not in dp:
			if l[j] != '?':
				dp.add(l[j])
			j += 1
			if j - i == 26:
				break
		else:
			while l[i] != l[j]:
				if l[i] != '?':
					dp.remove(l[i])
				i += 1
			i += 1
			j += 1
	if j - i == 26:
		for it in range(i):
			if l[it] == '?':
				l[it] = 'A'
		for it in range(i, j):
			if l[it] == '?':
				for al in alpha:
					if al not in dp:
						l[it] = al
						dp.add(al)
						break
		for it in range(j, n):
			if l[it] == '?':
				l[it] = 'A'
		return ''.join(l)
	else:
		return -1
s = input()
print(sol(s))


def fun(s):
	k = 0
	for i in s:
		if i != '?' and s.find(i) != s.rfind(i):
			return 0
	for i in s:
		if i == '?':
			for j in range(ord('A'), ord('Z') + 1):
				if s.find(chr(j)) == -1:
					s = s[:s.find(i)] + chr(j) + s[s.find(i) + 1:]
					break
	return s
S = input()
if S.__len__() < 26:
	print(-1)
else:
	i = 0
	for i in range(S.__len__() - 25):
		buf = fun(S[i:i + 26])
		if buf != 0:
			for j in range(0, i):
				if S[j] == '?':
					print('A', end='')
				else:
					print(S[j], end='')
			print(fun(S[i:i + 26]), end='')
			for j in range(i + 26, S.__len__()):
				if S[j] == '?':
					print('A', end='')
				else:
					print(S[j], end='')
			exit()
	print(-1)


import string
from collections import Counter

def main():
	s = list(input())
	if len(s) < 26:
		print(-1)
		return
	success = False
	cnt = Counter()
	for idx in range(len(s)):
		cnt[s[idx]] += 1
		if idx < 25:
			continue
		rpt = False
		for ch in string.ascii_uppercase:
			if cnt[ch] > 1:
				rpt = True
				break
		if not rpt:
			success = True
			quos = list()
			noops = list()
			for i in range(idx - 25, idx + 1):
				if s[i] == '?':
					quos.append(i)
			for ch in string.ascii_uppercase:
				if cnt[ch] == 0:
					noops.append(ch)
			assert len(quos) == len(noops)
			for i in range(len(quos)):
				s[quos[i]] = noops[i]
			break
		cnt[s[idx - 25]] -= 1
	if success:
		for i in range(len(s)):
			if s[i] == '?':
				s[i] = 'A'
		print(''.join(s))
	else:
		print(-1)
main()


pre_arr = [[] for __ in range(26)]
P_Q = []
s = [ch for ch in input()]
(l, r) = (0, 0)
found = False
condn = False
(L, R) = (None, None)
for i in s:
	if i == '?':
		if not P_Q:
			P_Q.append(1)
		else:
			P_Q.append(P_Q[-1] + 1)
	elif not P_Q:
		P_Q.append(0)
	else:
		P_Q.append(P_Q[-1])
while l <= r and r < len(s):
	if l == r:
		if s[r] != '?':
			pre_arr[ord(s[r]) - 65].append(r)
	elif s[r] != '?':
		if len(pre_arr[ord(s[r]) - 65]) > 0 and pre_arr[ord(s[r]) - 65][-1] >= l:
			l = pre_arr[ord(s[r]) - 65][-1] + 1
		pre_arr[ord(s[r]) - 65].append(r)
	r += 1
	if r - l > 25:
		req = P_Q[r - 1] if l == 0 else P_Q[r - 1] - P_Q[l - 1]
		if req > 0:
			found = True
			(L, R) = (l, r - 1)
			condn = True
			break
		else:
			condn = True
			break
if condn and (not found):
	L = 0
	R = len(s) - 1
if found or condn:
	i = 0
	bool_arr = [False] * 26
	stack = []
	while i < L:
		if s[i] == '?':
			s[i] = 'A'
		i += 1
	if found:
		while i <= R:
			if s[i] == '?':
				stack.append(i)
			else:
				bool_arr[ord(s[i]) - 65] = True
			i += 1
		for i in range(26):
			if not bool_arr[i]:
				s[stack[-1]] = chr(i + 65)
				stack.pop()
	while i < len(s):
		if s[i] == '?':
			s[i] = 'A'
		i += 1
	print(''.join(s))
else:
	print(-1)


s = input()
s = list(s)
res = -1
for i in range(len(s)):
	if i + 25 < len(s):
		d = {}
		count = 0
		for j in range(i, i + 26):
			if s[j] == '?':
				count += 1
			else:
				d[s[j]] = 1
		if count + len(d) == 26:
			for j in range(i, i + 26):
				if s[j] == '?':
					for k in range(65, 91):
						if chr(k) not in d:
							d[chr(k)] = 1
							s[j] = chr(k)
							break
			res = s
			break
	if res != -1:
		break
for i in range(len(s)):
	if s[i] == '?':
		s[i] = 'A'
if res == -1:
	print(-1)
else:
	print(''.join(res))


s = input()
m = len(s)
if m >= 26:
	st = 0
	n = 0
	for i in range(26):
		if s[i] != '?':
			n += 10 ** (ord(s[i]) - 65)
		else:
			st += 1
	flag = 0
	for i in range(26, m):
		if str(n + 10 ** 26).count('0') == st:
			flag = 1
			i -= 1
			break
		elif s[i] != '?' and s[i - 26] != '?':
			n += 10 ** (ord(s[i]) - 65) - 10 ** (ord(s[i - 26]) - 65)
		elif s[i - 26] != '?':
			n -= 10 ** (ord(s[i - 26]) - 65)
			st += 1
		elif s[i] != '?':
			n += 10 ** (ord(s[i]) - 65)
			st -= 1
	if str(n + 10 ** 26).count('0') == st:
		flag = 1
		i += 1
	if flag:
		ssss = s[i - 26:i]
		ss = []
		q = i
		for i in range(26):
			if ssss[i] != '?':
				ss.append(ssss[i])
		ss.sort()
		sss = []
		for i in range(65, 65 + 26):
			sss.append(chr(i))
		out = []
		for i in range(26):
			if sss[i] not in ss:
				out.append(sss[i])
		sssss = []
		j = 0
		for i in range(26):
			if ssss[i] != '?':
				sssss.append(ssss[i])
			else:
				sssss.append(out[j])
				j += 1
		ssss = ''.join(sssss)
		s = s[:q - 26] + ssss + s[q:]
		print(s.replace('?', 'Z'))
	else:
		print(-1)
else:
	print(-1)


s = input()

def solve(s):
	if len(s) < 26:
		return [-1]
	for i in range(len(s) - 25):
		tempset = set()
		q = 0
		for j in range(i, i + 26):
			if s[j] == '?':
				q += 1
			else:
				tempset.add(s[j])
		if q + len(tempset) == 26:
			return [1, i, i + 26]
	else:
		return [-1]
ans = solve(s)
if ans[0] == 1:
	(start, end) = (ans[1], ans[2])
	left = set()
	for i in range(97, 97 + 26):
		left.add(chr(i).upper())
	for i in range(start, end):
		if s[i] in left:
			left.remove(s[i])
	ans = ''
	for i in range(start):
		if s[i] == '?':
			ans += 'A'
		else:
			ans += s[i]
	for i in range(start, end):
		if s[i] == '?':
			ans += left.pop()
		else:
			ans += s[i]
	for i in range(end, len(s)):
		if s[i] == '?':
			ans += 'A'
		else:
			ans += s[i]
	print(ans)
else:
	print(-1)


def A(s):
	for i in range(len(s)):
		t = s[i:i + 26]
		if len(set(t)) == 26 or len(set(t)) + t.count('?') == 27:
			x = [chr(ord('A') + j) for j in range(26) if chr(ord('A') + j) not in t]
			for j in range(26):
				if s[i + j] == '?':
					s[i + j] = x.pop()
			for j in range(len(s)):
				if s[j] == '?':
					s[j] = 'A'
			return ''.join(s)
	return -1
print(A(list(input())))


from collections import Counter
s = input()
for i in range(len(s) - 25):
	t = s[i:i + 26]
	cnt = Counter(t)
	if len(cnt) - ('?' in cnt) + cnt['?'] == 26:
		print(s[:i].replace('?', 'A'), end='')
		cur = 'A'
		for c in t:
			if c != '?':
				print(c, end='')
			else:
				while cur in cnt:
					cur = chr(ord(cur) + 1)
				cnt[cur] += 1
				print(cur, end='')
		print(s[i + 26:].replace('?', 'A'))
		return
print(-1)


string = input()
q = 0
fl = 0
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if len(string) >= 26:
	for i in range(0, len(string) - 25):
		q = 0
		a = set(string[i:i + 26])
		for j in range(0, 26):
			if string[i + j] == '?':
				q += 1
		if q == 0 and len(a) == 26 or q + len(a) - 1 >= 26:
			fl = 1
			break
if fl == 0:
	print(-1)
else:
	newstr = string[i:i + 26]
	result = ''
	a = set(newstr)
	for char in newstr:
		if char == '?':
			for ch in alph:
				if not ch in a:
					result += ch
					a.add(ch)
					break
		else:
			result += char
	left = ''
	right = ''
	for char in string[0:i]:
		if char == '?':
			left += 'A'
		else:
			left += char
	for char in string[i + 26:]:
		if char == '?':
			right += 'A'
		else:
			right += char
	print(left + result + right)


def isF(a):
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			if a[j] == a[i] and a[j] != '?':
				return False
	return True
a = input()
alf = ['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']
flag = True
for i in range(len(a) - 25):
	str1 = list(a[i:i + 26])
	k = i
	if isF(str1):
		flag = False
		for i in range(len(str1)):
			if str1[i] != '?':
				alf.remove(str1[i])
		for i in range(len(str1)):
			if str1[i] == '?':
				str1[i] = alf[0]
				alf.remove(alf[0])
		break
if flag:
	print(-1)
else:
	a = list(a)
	a[k:k + 26] = str1
	for i in range(len(a)):
		if a[i] == '?':
			a[i] = 'A'
	for x in a:
		print(x, end='')
	print()


s = input()
if len(s) < 26:
	print(-1)
	exit(0)
for i in range(len(s) - 25):
	cnt = [0] * 26
	amount = 0
	qst = 0
	for j in range(i, i + 26):
		if s[j] != '?':
			if cnt[ord(s[j]) - ord('A')] == 0:
				amount += 1
			cnt[ord(s[j]) - ord('A')] += 1
			if cnt[ord(s[j]) - ord('A')] >= 2:
				break
		else:
			qst += 1
	if amount == 26 - qst:
		need_to_replace = []
		for j in range(0, 26):
			if cnt[j] == 0:
				need_to_replace.append(chr(j + ord('A')))
		j = 0
		ans = ''
		for k in range(0, i):
			if s[k] == '?':
				ans += 'A'
			else:
				ans += s[k]
		for k in range(i, i + 26):
			if s[k] == '?':
				ans += need_to_replace[j]
				j += 1
			else:
				ans += s[k]
		for k in range(i + 26, len(s)):
			if s[k] == '?':
				ans += 'A'
			else:
				ans += s[k]
		print(ans)
		exit(0)
print(-1)


s = list(input())
l = len(s)
if l < 26:
	print(-1)
else:
	flag = 0
	for i in range(l - 26 + 1):
		hash = [0] * 26
		st = []
		c = 0
		for j in range(i, i + 26):
			if s[j] == '?':
				c += 1
			else:
				hash[ord(s[j]) - 65] += 1
				st.append(s[j])
		if len(set(st)) == 26 - c:
			flag = 1
			t = []
			for j in range(26):
				if hash[j] == 0:
					t.append(chr(65 + j))
			for j in range(i, i + 26):
				if s[j] == '?':
					s[j] = t.pop()
			break
	if flag == 0:
		print(-1)
	else:
		for i in range(l):
			if s[i] == '?':
				s[i] = 'A'
		print(''.join(s))


import re
import collections
string = input()
string1 = re.findall('.', string)
check = 'ABCDEFGHIJKLMNOPQRSTUVWXYZS'
check = re.findall('.', check)
temp = ''
list1 = []
final = '-1'
var = 0
mid = ''
front = ''
end = ''
if len(string) < 26:
	print(-1)
elif string1.count('?') < 26 - len(set(string1)):
	print(-1)
else:
	for i in range(len(string) - 25):
		temp = re.findall('.', string[i:i + 26])
		if '?' in temp:
			leng = len(set(temp)) - 1
		else:
			leng = len(set(temp))
		if temp.count('?') >= 26 - leng:
			list1 = list(set(check) - set(temp))
			for j in range(26):
				if temp[j] == '?':
					temp[j] = list1[var]
					var += 1
			for item in temp:
				mid += item
			front = string[0:i].replace('?', 'A')
			end = string[i + 26:len(string) + 1].replace('?', 'A')
			final = front + mid + end
			break
	print(final)


s = list(input())
d = set()
n = len(s)
D = {'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'}
counter = 0
i_start = 0
if n < 26:
	print(-1)
else:
	i = 0
	while i < n and counter < 26:
		if s[i] == '?':
			counter += 1
		elif s[i] not in d:
			d.add(s[i])
			counter += 1
		else:
			d = set()
			counter = 0
			i = i_start
			i_start = i_start + 1
		i += 1
	if counter == 26:
		D.difference_update(d)
		for i in range(n):
			if s[i] == '?':
				if i_start <= i and i < i_start + 26:
					s[i] = D.pop()
				else:
					s[i] = 'A'
			print(s[i], end='')
	else:
		print(-1)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
s = ls()
n = len(s)
l = [0] * 26
if n < 26:
	exit(print(-1))
q = s[:26].count('?')
for j in s[:26]:
	if j != '?':
		l[ord(j) - ord('A')] += 1
sm = sum((i > 0 for i in l))
j = 0
i = 25
while i < n:
	if sm + q >= 26:
		for k in range(j, i + 1):
			if s[k] == '?':
				z = l.index(0)
				s[k] = chr(ord('A') + z)
				l[z] = 1
		x = ''.join((z for z in s)).replace('?', 'A')
		print(x)
		exit(0)
	else:
		if s[j] == '?':
			q -= 1
		else:
			l[ord(s[j]) - ord('A')] -= 1
		i += 1
		j += 1
		if i >= n:
			break
		if s[i] == '?':
			q += 1
		else:
			l[ord(s[i]) - ord('A')] += 1
		sm = sum((x > 0 for x in l))
print(-1)


s = input()
n = len(s)
(flag, p) = (0, 0)
if n < 26:
	print(-1)
	exit(0)
else:
	f = []
	for i in range(26):
		f.append(0)
	for i in range(0, n - 25):
		(cnt1, cnt2) = (0, 0)
		for j in range(26):
			f[j] = 0
		for j in range(26):
			if s[i + j] == '?':
				cnt1 = cnt1 + 1
			elif f[ord(s[i + j]) - ord('A')] == 0:
				f[ord(s[i + j]) - ord('A')] = 1
				cnt2 = cnt2 + 1
		if cnt1 + cnt2 == 26:
			flag = 1
			p = i
			break
if flag == 1:
	for i in range(p):
		if s[i] == '?':
			print('A', end='')
		else:
			print(s[i], end='')
	for i in range(p, n):
		if s[i] == '?':
			tag = 0
			for j in range(26):
				if f[j] == 0:
					f[j] = 1
					tag = 1
					print(chr(ord('A') + j), end='')
					break
			if tag == 0:
				print('A', end='')
		else:
			print(s[i], end='')
	print('')
else:
	print(-1)


s = str(input())
n = len(s)
A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
if n < 26:
	print(-1)
else:
	for i in range(n - 25):
		ok = 1
		F = [0 for _ in range(26)]
		for j in range(26):
			if s[i:i + 26].count(A[j]) > 1:
				ok = 0
				break
			elif s[i:i + 26].count(A[j]) == 0:
				F[j] = 1
		if ok:
			break
	if ok == 0:
		print(-1)
	else:
		j = 0
		for k in range(n):
			if s[k] == '?':
				if k >= i and k < i + 26:
					while F[j] == 0:
						j += 1
					print(A[j], end='')
					F[j] = 0
				else:
					print('A', end='')
			else:
				print(s[k], end='')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
import random
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def main():
	s = [_ for _ in S()]
	c = collections.defaultdict(int)
	cc = 0
	l = len(s)
	if l < 26:
		return -1
	for t in s[:26]:
		if t == '?':
			continue
		c[t] += 1
		if c[t] == 2:
			cc += 1
	if cc == 0:
		for i in range(26):
			t = s[i]
			if t == '?':
				for k in string.ascii_uppercase:
					if c[k] == 0:
						c[k] += 1
						s[i] = k
						break
		for i in range(26, l):
			if s[i] == '?':
				s[i] = 'A'
		return ''.join(s)
	for i in range(26, l):
		t = s[i - 26]
		if t != '?':
			c[t] -= 1
			if c[t] == 1:
				cc -= 1
		u = s[i]
		if u != '?':
			c[u] += 1
			if c[u] == 2:
				cc += 1
		if cc == 0:
			for j in range(i - 25, i + 1):
				t = s[j]
				if t == '?':
					for k in string.ascii_uppercase:
						if c[k] == 0:
							c[k] += 1
							s[j] = k
							break
			for j in range(l):
				if s[j] == '?':
					s[j] = 'A'
			return ''.join(s)
	return -1
print(main())


s = input()
check_lst = [0] * 26
str_len = len(s)

def test():
	for c in check_lst:
		if c > 1:
			return 0
	return 1

def print_str(start):
	target_str = ''
	lost_str = ''
	lost_index = 0
	for c in range(26):
		if not check_lst[c]:
			lost_str += chr(65 + c)
	for i in s[start:start + 26]:
		if i != '?':
			target_str += i
		else:
			target_str += lost_str[lost_index]
			lost_index += 1
	return s[:start].replace('?', 'A') + target_str + s[start + 26:].replace('?', 'A')

def check():
	for i in range(26):
		if s[i] != '?':
			check_lst[ord(s[i]) - 65] += 1
	if test():
		return print_str(0)
	else:
		start = 0
		while start < str_len - 26:
			if s[start] != '?':
				check_lst[ord(s[start]) - 65] -= 1
			if s[start + 26] != '?':
				check_lst[ord(s[start + 26]) - 65] += 1
			if not test():
				start += 1
			else:
				return print_str(start + 1)
		return -1
if len(s) < 26:
	print(-1)
else:
	print(check())


def main():
	s = input()
	if len(s) < 26:
		return print(-1)
	abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	rest = dict.fromkeys(abc, 1)
	rest['?'] = 99
	for head in s[:26]:
		rest[head] -= 1
	twins = sum((x < 0 for x in rest.values()))

	def show(h):
		t = h + 26
		print(s[:h].replace('?', 'A'), s[h:t].replace('?', '{}').format(*filter(rest.get, abc)), s[t:].replace('?', 'A'), sep='')
	if not twins:
		return show(0)
	for (i, head, tail) in zip(range(1, 50000), s[26:], s):
		if not rest[head]:
			twins += 1
		rest[head] -= 1
		rest[tail] += 1
		if not rest[tail]:
			twins -= 1
			if not twins:
				return show(i)
	print(-1)
main()


a = list(input())
n = len(a)
aa = ord('A')
zz = ord('Z')
if n >= 26:
	d = {chr(i): 0 for i in range(aa, zz + 1)}
	d['?'] = 0
	start = a[:26]
	for i in start:
		d[i] += 1
	q = 0
	bl = False
	toswitch = []
	for i in range(aa, zz + 1):
		if d[chr(i)] == 0:
			q += 1
			toswitch.append(chr(i))
		elif d[chr(i)] > 1:
			break
	else:
		if q == d['?']:
			for i in range(26):
				if a[i] == '?':
					a[i] = toswitch[-1]
					toswitch.pop()
			for i in range(26, n):
				if a[i] == '?':
					a[i] = 'A'
			bl = True
			print(*a, sep='')
	if not bl:
		for l in range(1, n - 25):
			d[a[l - 1]] -= 1
			d[a[l + 25]] += 1
			q = 0
			toswitch = []
			for i in range(aa, zz + 1):
				if d[chr(i)] == 0:
					q += 1
					toswitch.append(chr(i))
				elif d[chr(i)] > 1:
					break
			else:
				if q == d['?']:
					for i in range(l, l + 26):
						if a[i] == '?':
							a[i] = toswitch[-1]
							toswitch.pop()
					for i in range(l):
						if a[i] == '?':
							a[i] = 'A'
					for i in range(l + 26, n):
						if a[i] == '?':
							a[i] = 'A'
					print(*a, sep='')
					break
		else:
			print(-1)
else:
	print(-1)


import sys

def is_solution(substr):
	alpha = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
	question_count = 0
	for (i, letter) in enumerate(substr):
		if letter == '?':
			question_count += 1
		elif letter not in alpha:
			return (None, False)
		else:
			alpha -= set(letter)
	if len(alpha) != question_count:
		return (None, False)
	solution = ''
	for (i, letter) in enumerate(substr):
		if letter != '?':
			solution += letter
		else:
			solution += alpha.pop()
	return (solution, True)
input_str = input()
for i in range(0, len(input_str) - 25):
	substr = input_str[i:i + 26]
	(solution, result) = is_solution(substr)
	if result:
		for j in range(0, i):
			if input_str[j] == '?':
				print('A', end='')
			else:
				print(input_str[j], end='')
		print(solution, end='')
		for j in range(i + 26, len(input_str)):
			if input_str[j] == '?':
				print('A', end='')
			else:
				print(input_str[j], end='')
		sys.exit()
print(-1)


s = input()

def countcheck(n, p):
	if p.count(n) == 0 or p.count(n) == 1:
		return 1
	else:
		return 0
	return 1

def printstring(p):
	li = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
	l = []
	for k in li:
		if k not in p:
			l.append(k)
	for k in p:
		if k in li:
			print(k, end='')
		else:
			print(l.pop(), end='')
if len(s) < 26:
	print('-1')
else:
	i = 0
	p = True
	while p:
		p = s[i:i + 26]
		c = 0
		for j in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
			q = countcheck(j, p)
			if q:
				continue
			else:
				c = 1
				break
		if c:
			if i + 26 < len(s):
				i += 1
			else:
				print('-1')
				p = False
		elif c == 0 and j == 'Z':
			for j in s[:i]:
				if j in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
					print(j, end='')
				else:
					print('A', end='')
			printstring(p)
			for j in s[i + 26:]:
				if j in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
					print(j, end='')
				else:
					print('A', end='')
			p = False


import collections, string

def check(cnt):
	chars = [k for (k, v) in cnt.items() if v > 0]
	return len(chars) == 26 or len(chars) + cnt['?'] - 1 == 26

def fill(s, pos, cnt):
	chars = {k for (k, v) in cnt.items() if v > 0}
	missing = [c for c in string.ascii_uppercase if c not in chars]
	for i in range(pos - 25, pos + 1):
		c = s[i]
		if c == '?':
			s[i] = missing.pop()

def main():
	s = list(input())
	cnt = collections.Counter()
	for i in range(min(25, len(s))):
		c = s[i]
		cnt[c] += 1
	found = False
	for i in range(25, len(s)):
		if i > 25:
			c_ = s[i - 26]
			cnt[c_] -= 1
		c = s[i]
		cnt[c] += 1
		if check(cnt):
			fill(s, i, cnt)
			found = True
			break
	if found:
		for (i, c) in enumerate(s):
			if c == '?':
				s[i] = 'A'
		print(str.join('', s))
	else:
		print(-1)
main()


import time

def number(x):
	return ord(x) - ord('A')

def test(a):
	for i in a:
		if i > 1:
			return False
	return True
L = 26
s = input()
start = time.time()
ans = -1
if len(s) >= 26:
	a = [0 for i in range(L)]
	for i in s[:26]:
		if i != '?':
			a[number(i)] += 1
	t = test(a)
	l = 0
	r = 25
	while t == False and r < len(s) - 1:
		if s[l] != '?':
			a[number(s[l])] -= 1
		l += 1
		r += 1
		if s[r] != '?':
			a[number(s[r])] += 1
		t = test(a)
	if t == True:
		ans = list(s)
		j = l
		for i in range(len(a)):
			if a[i] == 0:
				while ans[j] != '?':
					j += 1
				ans[j] = chr(i + ord('A'))
		for i in range(len(ans)):
			if ans[i] == '?':
				ans[i] = 'A'
		news = ''
		for i in ans:
			news += i
		ans = news
print(ans)
finish = time.time()


def isOk(d):
	for i in d:
		if d[i] > 1:
			return 0
	return 1

def substring(s, d, left, right):
	alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	low = 0
	ans = ''
	for i in range(left, right + 1):
		if s[i] == '?':
			while alpha[low] in d and d[alpha[low]] == 1:
				low += 1
			ans += alpha[low]
			low += 1
		else:
			ans += s[i]
	return ans
s = input()
n = len(s)
if n < 26:
	print(-1)
	exit(0)
d = {}
for i in range(26):
	if s[i] in d:
		d[s[i]] += 1
	elif s[i] != '?':
		d[s[i]] = 1
left = 0
right = 25
while right < n:
	if isOk(d):
		print(s[:left].replace('?', 'A') + substring(s, d, left, right) + s[right + 1:].replace('?', 'A'))
		exit(0)
	else:
		if s[left] != '?':
			d[s[left]] -= 1
			left += 1
		else:
			left += 1
		if s[right] != '?':
			right += 1
			if right >= n:
				break
			if s[right] in d:
				d[s[right]] += 1
			elif s[right] != '?':
				d[s[right]] = 1
		else:
			right += 1
			if right >= n:
				break
			if s[right] in d:
				d[s[right]] += 1
			elif s[right] != '?':
				d[s[right]] = 1
print(-1)


s = input()
q = ['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']
qt = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
counts = {x: 0 for x in q}
counts['?'] = -26
if len(s) < 26:
	print(-1)
	exit()
for i in s[:26]:
	counts[i] += 1
if max(counts.values()) < 2:
	cur_slice = s[:26]
	for i in cur_slice:
		qt = qt.replace(i, '')
	for i in cur_slice:
		if i != '?':
			print(i, end='')
		else:
			temp = qt[0]
			qt = qt.replace(temp, '')
			print(temp, end='')
	print(s[26:].replace('?', 'A'))
	exit()
shift = 1
while shift + 26 <= len(s):
	cur_slice = s[shift:shift + 26]
	counts[s[shift - 1]] -= 1
	counts[cur_slice[-1]] += 1
	if max(counts.values()) < 2:
		for i in cur_slice:
			qt = qt.replace(i, '')
		print(s[:shift].replace('?', 'A'), end='')
		for i in cur_slice:
			if i != '?':
				print(i, end='')
			else:
				temp = qt[0]
				qt = qt.replace(temp, '')
				print(temp, end='')
		print(s[shift + 26:].replace('?', 'A'), end='')
		exit()
	shift += 1
print(-1)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]
spf_sieve()

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')

def fill(string):
	for i in range(len(string)):
		if string[i] == '?':
			string[i] = 'A'
string = input().strip()
n = len(string)
f = 0
if n < 26:
	print(-1)
	exit()
string = list(string)
dick = {}
alps = {chr(i) for i in range(65, 65 + 26)}
for i in range(26):
	if string[i] != '?':
		dick[string[i]] = dick.get(string[i], 0) + 1
if len(dick) == 0 or max(list(dick.values())) == 1:
	f = 1
	this = set(dick.keys())
	rem = list(alps.difference(this))
	for i in rem:
		for j in range(26):
			if string[j] == '?':
				string[j] = i
				break
	fill(string)
	print(''.join(string))
	exit()
for i in range(1, n - 26 + 1):
	if string[i - 1] != '?':
		dick[string[i - 1]] -= 1
		if dick[string[i - 1]] == 0:
			del dick[string[i - 1]]
	if string[i + 26 - 1] != '?':
		dick[string[i + 26 - 1]] = dick.get(string[i + 26 - 1], 0) + 1
	if len(dick) == 0 or max(list(dick.values())) == 1:
		f = 1
		this = set(dick.keys())
		rem = list(alps.difference(this))
		for r in rem:
			for j in range(i, i + 26):
				if string[j] == '?':
					string[j] = r
					break
		fill(string)
		print(''.join(string))
		exit()
print(-1)


from string import ascii_uppercase
chars = {k for k in ascii_uppercase}
st = [j for j in input()]
n = len(st)
if n < 26:
	print(-1)
	exit()
for i in range(n - 26 + 1):
	idx_q = []
	char = set()
	flag = 1
	q = 0
	for j in range(i, i + 26):
		if st[j] != '?':
			if st[j] in char:
				flag = 0
				break
			char.add(st[j])
		else:
			q += 1
			idx_q.append(j)
	if flag:
		if 26 - len(char) == q:
			for (idx, cq) in zip(idx_q, chars - char):
				st[idx] = cq
			print(''.join(st).replace('?', 'A'))
			exit()
print(-1)


st = input()
n = len(st)
f = 0
l = [0] * 26
ans = ''
if n < 26:
	f = 0
else:
	cq = 0
	for i in range(26):
		if st[i] == '?':
			cq += 1
		else:
			l[ord(st[i]) - ord('A')] += 1
	c = 0
	s1 = ''
	for i in range(26):
		if l[i] == 1:
			c += 1
		else:
			s1 += chr(ord('A') + i)
	if c + cq == 26:
		f = 1
	if f:
		ans = ''
		k = 0
		for i in range(26):
			if st[i] == '?':
				ans += s1[k]
				k += 1
			else:
				ans += st[i]
		for i in range(26, n):
			if st[i] == '?':
				ans += 'Z'
			else:
				ans += st[i]
	else:
		i = 0
		j = 26
		while j < n:
			if st[i] == '?':
				cq -= 1
			else:
				l[ord(st[i]) - ord('A')] -= 1
			if st[j] == '?':
				cq += 1
			else:
				l[ord(st[j]) - ord('A')] += 1
			c = 0
			s1 = ''
			for z in range(26):
				if l[z] == 1:
					c += 1
				else:
					s1 += chr(ord('A') + z)
			if c + cq == 26:
				f = 1
			if f:
				ans = ''
				k = 0
				for z in range(i + 1, j + 1):
					if st[z] != '?':
						ans += st[z]
					else:
						ans += s1[k]
						k += 1
				for z in range(j + 1, n):
					if st[z] == '?':
						ans += 'Z'
					else:
						ans += st[z]
				for z in range(i, -1, -1):
					if st[z] == '?':
						ans = 'Z' + ans
					else:
						ans = st[z] + ans
				break
			i += 1
			j += 1
if f:
	print(ans)
else:
	print(-1)


letter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
data = list(input())
done = False
for I in range(len(data) - 25):
	K = data[I:I + 26]
	s = data[I:I + 26]
	count = 0
	while '?' in s:
		s.remove('?')
		count += 1
	if len(set(letter) - set(s)) == count:
		W = list(set(letter) - set(s))
		for X in range(len(data)):
			if data[X] == '?':
				if I <= X < I + 26:
					data[X] = W[0]
					W.pop(0)
				else:
					data[X] = 'A'
		done = True
	if done:
		break
if not done:
	print(-1)
else:
	print(''.join(data))


s = list(input())
n = len(s)
if n < 26:
	print(-1)
else:
	a = [0] * 26
	c = 0
	j = 0
	(x, y) = (-1, -1)
	for q in range(26):
		if s[q] == '?':
			j += 1
		else:
			a[ord(s[q]) - 65] += 1
			if a[ord(s[q]) - 65] == 1:
				c += 1
	if j + c == 26:
		(x, y) = (0, 25)
	else:
		for q in range(26, n):
			if s[q - 26] == '?':
				j -= 1
			else:
				a[ord(s[q - 26]) - 65] -= 1
				if a[ord(s[q - 26]) - 65] == 0:
					c -= 1
			if s[q] == '?':
				j += 1
			else:
				a[ord(s[q]) - 65] += 1
				if a[ord(s[q]) - 65] == 1:
					c += 1
			if j + c == 26:
				(x, y) = (q - 26 + 1, q)
				break
	if x == -1:
		print(-1)
	else:
		for q in range(x):
			if s[q] == '?':
				s[q] = 'A'
		for q in range(y + 1, n):
			if s[q] == '?':
				s[q] = 'A'
		w = 0
		for q in range(x, y + 1):
			if s[q] == '?':
				while a[w]:
					w += 1
				s[q] = chr(65 + w)
				w += 1
		print(''.join(s))


def getReplacement(s):
	nReplacements = 0
	seen = {}
	result = ''
	for char in s:
		if char == '?':
			nReplacements += 1
		else:
			if char in seen:
				return result
			seen[char] = True
	for char in s:
		if char == '?':
			for alpha in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
				if alpha not in seen:
					result += alpha
					seen[alpha] = True
					break
		else:
			result += char
	return result
s = input()
found = False
for i in range(len(s) - 25):
	replacement = getReplacement(s[i:i + 26])
	if replacement != '':
		s = s[:i] + replacement + s[i + 26:]
		result = ''
		for char in s:
			if char == '?':
				result += 'A'
			else:
				result += char
		found = True
		print(result)
		break
if not found:
	print('-1')


from collections import deque as de
import math
from math import sqrt as sq
from math import floor as fl
from math import ceil as ce
from sys import stdin, stdout
import re
from collections import Counter as cnt
from functools import reduce
from itertools import groupby as gb
from bisect import bisect_left as bl, bisect_right as br

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binarytodecimal(n):
	return int(n, 2)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def getProduct(n):
	product = 1
	while n != 0:
		product = product * (n % 10)
		n = n // 10
	return product

def lcm(x, y):
	lcm = x * y // math.gcd(x, y)
	return lcm

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def checkisap(list):
	d = list[1] - list[0]
	for i in range(2, len(list)):
		temp = list[i] - list[i - 1]
		if temp != d:
			return False
	return True

def primes_method5(n):
	out = {}
	sieve = [True] * (n + 1)
	for p in range(2, n + 1):
		if sieve[p]:
			out[p] = 1
			for i in range(p, n + 1, p):
				sieve[i] = False
	return out

def getSum(n):
	strr = str(n)
	list_of_number = list(map(int, strr.strip()))
	return sum(list_of_number)

def ceildiv(x, y):
	return (x + y - 1) // y

def di():
	return map(int, input().split())

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def si():
	return list(map(str, input()))

def indict():
	dic = {}
	for (index, value) in enumerate(input().split()):
		dic[int(value)] = int(index) + 1
	return dic

def frqdict():
	dic = {}
	for (index, value) in enumerate(input()):
		if value not in dic:
			dic[value] = 1
		else:
			dic[value] += 1
	return dic
s = si()
if len(s) < 26:
	print(-1)
else:
	ans = 1
	for i in range(len(s) - 26 + 1):
		temp = s[i:i + 26]
		if '?' not in temp:
			dictemp = {}
			ch = 1
			for ele in temp:
				if ele not in dictemp:
					dictemp[ele] = 1
				else:
					ch = 0
					break
			if ch:
				ans = 0
				break
		else:
			checker = {'A': 1, 'B': 1, 'C': 1, 'D': 1, 'E': 1, 'F': 1, 'G': 1, 'H': 1, 'I': 1, 'J': 1, 'K': 1, 'L': 1, 'M': 1, 'N': 1, 'O': 1, 'P': 1, 'Q': 1, 'R': 1, 'S': 1, 'T': 1, 'U': 1, 'V': 1, 'W': 1, 'X': 1, 'Y': 1, 'Z': 1}
			dictemp = {}
			questioncount = 0
			for ele in temp:
				if ele == '?':
					questioncount += 1
				elif ele in checker:
					del checker[ele]
			if len(checker) == questioncount:
				ans = 0
				tempchecker = ''
				for key in checker:
					tempchecker += key
				j = 0
				for i in range(i, i + 26):
					if s[i] == '?':
						s[i] = tempchecker[j]
						j += 1
				break
	if ans:
		print(-1)
	else:
		for i in range(len(s)):
			if s[i] == '?':
				s[i] = 'A'
			print(s[i], end='')


import logging
import copy
import sys
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(string):
	if len(string) < 26:
		return -1
	(slow, fast) = (0, 25)
	m = dict()
	alphats = 'ABCDEFGHIJKLMNOPQRZTUVWXYS'
	for ch in alphats:
		m[ch] = 0
	m['?'] = 0
	for i in range(25):
		ch = string[i]
		m[ch] += 1
	prefix = ''
	for fast in range(25, len(string)):
		slow = fast - 25
		m[string[fast]] += 1
		if slow - 1 >= 0:
			m[string[slow - 1]] -= 1
			if string[slow - 1] == '?':
				prefix += 'A'
			else:
				prefix += string[slow - 1]
		if check(m):
			substr = genString(string[slow:fast + 1], m)
			substr = prefix + substr
			if fast < len(string) - 1:
				substr += string[fast + 1:].replace('?', 'A')
			return substr
	return -1

def genString(string, m):
	if m['?'] == 0:
		return string
	alphats = 'ABCDEFGHIJKLMNOPQRZTUVWXYS'
	subStr = ''
	for ch in string:
		if ch != '?':
			subStr += ch
			continue
		for candi in alphats:
			if m[candi] == 0:
				m[candi] += 1
				subStr += candi
				break
	return subStr

def check(m):
	alphats = 'ABCDEFGHIJKLMNOPQRZTUVWXYS'
	for ch in alphats:
		if ch in m:
			if m[ch] > 1:
				return False
	return True

def main():
	firstLine = input()
	print(solve(firstLine))

def log(*message):
	logging.debug(message)
main()


def main():
	(s, cnt) = (input(), [-1] * 91)
	l = s.encode('utf-8')
	for c in l[:25]:
		cnt[c] += 1
	(twins, cnt[63]) = (sum((i > 0 for i in cnt[65:])), -27)
	for (i, u, v) in zip(range(50000), l, l[25:]):
		cnt[v] = c = cnt[v] + 1
		if c == 1:
			twins += 1
		elif not twins:
			res = [s[:i].replace('?', 'A')]
			for c in filter(cnt.__getitem__, range(65, 91)):
				while c:
					a = l[i]
					if a == 63:
						(a, c) = (c, 0)
					res.append(chr(a))
					i += 1
			res.append(s[i:].replace('?', 'A'))
			return print(*res, sep='')
		cnt[u] = c = cnt[u] - 1
		if not c:
			twins -= 1
	print(-1)
main()


s = input()
n = len(s)
if n < 26:
	print(-1)
	exit()
s = list(s)
j = 0
x = ord('A')
a = [0] * 26
while j + 26 <= n:
	flag = 1
	for k in range(j, j + 26):
		if s[k] != '?':
			if a[ord(s[k]) - x] == 0:
				a[ord(s[k]) - x] = 1
			else:
				a = [0] * 26
				j = j + 1
				flag = 0
				break
	if flag == 1:
		p = 0
		for k in range(j, j + 26):
			if s[k] == '?':
				while a[p] != 0:
					p += 1
				s[k] = chr(x + p)
				p += 1
		for i in range(n):
			if s[i] == '?':
				s[i] = 'A'
		print(''.join(s))
		exit()
print(-1)


def is_nice(strs):
	strs = list(strs)
	if len(strs) < 26:
		return -1
	satis = False
	for i in range(len(strs) - 26 + 1):
		ret = strs[i:i + 26]
		seen = [0] * 26
		for c in ret:
			if c == '?':
				continue
			seen[ord(c) - ord('A')] += 1
		if seen.count(0) != ret.count('?'):
			continue
		else:
			satis = True
			miss = ''
			for j in range(len(seen)):
				if seen[j] == 0:
					miss += chr(j + ord('A'))
			idx = 0
			for c in range(len(ret)):
				if ret[c] == '?':
					strs[i + c] = miss[idx]
					idx += 1
		if satis:
			break
	if satis == False:
		return -1
	for i in range(len(strs)):
		if strs[i] == '?':
			strs[i] = 'A'
	return ''.join(strs)
s = input()
print(is_nice(s))


s = input()
n = len(s)
l = []
x = 0
y = 0
f = 0
k = 0
for i in range(26):
	l.append(0)
for i in range(n - 25):
	for t in range(26):
		if s[i + t] == '?':
			y = y + 1
		elif l[ord(s[i + t]) - ord('A')] == 0:
			l[ord(s[i + t]) - ord('A')] = 1
			y = y + 1
		else:
			for j in range(26):
				l[j] = 0
			y = 0
		if y == 26:
			f = 1
			break
	if f == 1:
		break
	for j in range(26):
		l[j] = 0
	y = 0
i = i + 25
if f == 0:
	print(-1)
else:
	for j in range(n):
		if j < i - 25 or j > i:
			if s[j] == '?':
				print('A', end='')
			else:
				print(s[j], end='')
		elif s[j] == '?':
			while l[k] != 0:
				k = k + 1
			print(chr(k + ord('A')), end='')
			k = k + 1
		else:
			print(s[j], end='')
print


def sol(s):
	l = list(s)
	alpha = 'abcdefghijklmnopqrstuvwxyz'
	alpha = alpha.upper()
	i = 0
	j = 0
	n = len(s)
	dp = set()
	while j < n:
		if l[j] not in dp:
			dp.add(l[j])
		elif l[j] != '?':
			while l[i] != l[j]:
				if l[i] != '?':
					dp.remove(l[i])
				i += 1
			i += 1
		j += 1
		if j - i == 26:
			break
	if j - i < 26:
		return -1
	for it in range(i, j):
		if l[it] == '?':
			for ch in alpha:
				if ch not in dp:
					l[it] = ch
					dp.add(ch)
					break
	for ch in range(i):
		if l[ch] == '?':
			l[ch] = 'A'
	for ch in range(j, n):
		if l[ch] == '?':
			l[ch] = 'A'
	return ''.join(l)
s = input()
print(sol(s))


def f(s):
	s = list(s)
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'A'
	res = ''
	for i in range(len(s)):
		res += s[i]
	return res
s = input()
n = len(s)
d = dict()
for i in range(26):
	d[chr(i + 65)] = i
ans = 0
for i in range(25, n):
	ko = []
	k = 0
	a = [0] * 26
	for j in range(26):
		if s[i - j] != '?':
			a[d[s[i - j]]] += 1
		else:
			k += 1
	for j in range(26):
		if not a[j]:
			ko.append(chr(j + 65))
	if k >= len(ko):
		new = s[i - 25:i + 1]
		for j in range(26):
			if new[j] == '?':
				new = new[:j] + ko[-1] + new[j + 1:]
				ko.pop()
		print(f(s[:i - 25]) + new + f(s[i + 1:]))
		ans = 1
		break
if not ans:
	print(-1)


def main():

	def f(i):
		k = 65
		for j in range(i - 26, i):
			c = l[j]
			if c == '?':
				while cnt[k]:
					k += 1
				l[j] = chr(k)
				k += 1
		for (j, c) in enumerate(l):
			if c == '?':
				l[j] = 'A'
		print(''.join(l))
		return
	l = list(input())
	if len(l) < 26:
		print(-1)
		return
	cnt = [0] * 128
	for i in range(26):
		cnt[ord(l[i])] += 1
	for (i, c) in zip(range(26, len(l)), l):
		if all((cnt[j] < 2 for j in range(65, 91))):
			f(i)
			return
		cnt[ord(l[i])] += 1
		cnt[ord(c)] -= 1
	if all((cnt[j] < 2 for j in range(65, 91))):
		f(len(l))
		return
	print(-1)
main()


import sys
string = input()
l = len(string)
if l < 26:
	print(-1)
	sys.exit()
for i in range(l - 25):
	str = [0] * 27
	q = 0
	t = 0
	for j in string[i:i + 26]:
		if j == '?':
			q += 1
		else:
			str[int(ord(j) - 65)] = 1
	if 26 - sum(str) == q:
		list = list(string[i:i + 26])
		for k in range(26):
			if list[k] == '?':
				for m in range(26):
					if str[m] == 0:
						list[k] = chr(m + 65)
						str[m] = 1
						break
		word = string[0:i].replace('?', 'A') + ''.join(list) + string[i + 26:].replace('?', 'A')
		print(word)
		sys.exit()
print(-1)


import sys, math, bisect
from random import randint
inf = float('inf')
mod = 10 ** 9 + 7

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def primesInRange(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def primeFactors(n):
	factors = []
	while n % 2 == 0:
		factors.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			factors.append(i)
			n = n // i
	if n > 2:
		factors.append(n)
	return factors

def isPrime(n, k=5):
	if n < 2:
		return True
	for i in range(0, k):
		a = randint(1, n - 1)
		if pow(a, n - 1, n) != 1:
			return False
	return True
all = ['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']
from collections import deque, defaultdict, Counter
import heapq, string
for _ in range(1):
	s = list(input())
	n = len(s)
	if n < 26:
		print(-1)
	else:
		req = []
		flag = False
		for _ in range(n - 26 + 1):
			str = s[_:_ + 26]
			cnt = 0
			z = str.count('?')
			str = set(str)
			missing = []
			for i in all:
				if i not in str:
					missing.append(i)
					cnt += 1
			if cnt == z:
				req = missing
				flag = True
				x = len(req)
				k = 0
				for j in range(_, _ + 26):
					if s[j] == '?':
						s[j] = req[k]
						k += 1
				break
		if not flag:
			print(-1)
		else:
			for i in range(n):
				if s[i] == '?':
					s[i] = 'A'
			print(''.join(s))


s = input()
seen = []
cnt = 0
start = 0
end = 26
for i in range(len(s)):
	c = s[i]
	if cnt == 26:
		end = i
		break
	elif c == '?':
		if seen == []:
			start = i
		seen.append(c)
		cnt += 1
	elif c in seen:
		q = seen.index(c)
		l = len(seen)
		seen = seen[q + 1:]
		start += l - len(seen)
		seen.append(c)
		cnt = cnt - q
	else:
		if seen == []:
			start = i
		seen.append(c)
		cnt += 1
if cnt != 26:
	print('-1')
else:
	for i in range(len(seen)):
		if seen[i] == '?':
			for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
				if c not in seen:
					seen[i] = c
					break
	ret = s[:start]
	for c in seen:
		ret += c
	try:
		ret += s[start + 26:]
	except:
		pass
	for c in ret:
		if c == '?':
			c = 'A'
		print(c, end='')
	print()


def check(d):
	count_un = d['?']
	count_d = 0
	st = []
	for i in d:
		if d[i] != 0 and i != '?':
			count_d += 1
		if d[i] == 0:
			st.append(i)
	return (count_d + count_un == 26, st)
s = input()
d = dict()
for i in range(ord('A'), ord('Z') + 1):
	d[chr(i)] = 0
d['?'] = 0
if len(s) < 26:
	print(-1)
else:
	for i in range(26):
		d[s[i]] += 1
	l = 0
	r = 25
	ans = 0
	while True:
		if r == len(s):
			break
		(x, st) = check(d)
		if x:
			help = ''
			for i in range(l, r + 1):
				if s[i] != '?':
					help += s[i]
				else:
					help += st[-1]
					st.pop()
			ans = s[:l] + help + s[r + 1:]
			break
		d[s[l]] -= 1
		l += 1
		r += 1
		if r == len(s):
			break
		d[s[r]] += 1
	new = ''
	if ans != 0:
		for i in ans:
			if i == '?':
				new += 'A'
			else:
				new += i
		print(new)
	else:
		print(-1)


def check(st):
	st = list(st)
	letters = [0] * 26
	question_makrs = []
	for i in range(len(st)):
		if st[i] == '?':
			question_makrs.append(i)
		elif letters[ord(st[i]) - 65] >= 1:
			return (False, '')
		else:
			letters[ord(st[i]) - 65] += 1
	for i in range(len(letters)):
		if letters[i] == 0:
			st[question_makrs.pop()] = chr(i + 65)
	return (True, ''.join(st))
s = input()
if len(s) < 26:
	print(-1)
else:
	con = False
	final_str = ''
	for i in range(len(s)):
		if i + 26 <= len(s):
			(con, st) = check(s[i:i + 26])
			if con:
				final_str = s[:i] + st + s[i + 26:]
				break
		else:
			break
	final_str = final_str.replace('?', 'X')
	if con:
		print(final_str)
	else:
		print(-1)


def fill_in(s):
	s_a = 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'])
	s_x = set((x for x in s))
	if '?' in s_x:
		s_x.remove('?')
	for x in s_x:
		s_a.remove(x)
	s_o = list()
	for x in s:
		if x == '?':
			s_o.append(s_a.pop())
		else:
			s_o.append(x)
	return ''.join(s_o)
s = input()
d_c = {}
for i in range(len(s)):
	if s[i] not in d_c:
		d_c[s[i]] = 0
	d_c[s[i]] += 1
	if i >= 25:
		if len(d_c) - (1 if '?' in d_c else 0) + (0 if '?' not in d_c else d_c['?']) == 26:
			s_f = s[:i - 25].replace('?', 'A')
			s_l = '' if i + 1 == len(s) else s[i + 1:].replace('?', 'A')
			s = s_f + fill_in(s[i - 25:i + 1]) + s_l
			print(s)
			quit()
		d_c[s[i - 25]] -= 1
		if d_c[s[i - 25]] == 0:
			del d_c[s[i - 25]]
print(-1)


import os
import re
import sys
from bisect import bisect, bisect_left, insort, insort_left
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from io import BytesIO, IOBase
from itertools import accumulate, combinations, combinations_with_replacement, groupby, permutations, product
from math import acos, asin, atan, ceil, cos, degrees, factorial, hypot, log2, pi, radians, sin, sqrt, tan
from operator import itemgetter, mul
from string import ascii_lowercase, ascii_uppercase, digits

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instr():
	s = input()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def searchCar(res):
	temp = 'ABCDEFGHIJKLMNOPQRZTUVWXYS'
	for i in temp:
		if i not in res:
			return i

def main():
	a = input()
	n = len(a)
	i = 0
	j = 25
	res = None
	while j < n:
		temp = list(a[i:j + 1])
		totalLen = 26 - temp.count('?')
		c_set = set()
		for c in temp:
			if c != '?':
				c_set.add(c)
		if len(c_set) == totalLen:
			for k in range(len(temp)):
				if temp[k] == '?':
					temp[k] = searchCar(temp)
			res = list(a[:i]) + temp + list(a[j + 1:])
			break
		i += 1
		j += 1
	if res:
		for i in res:
			if i == '?':
				i = 'Z'
			print(i, end='')
		print()
	else:
		print(-1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


base = ord('A')
s = input()
if len(s) < 26:
	print(-1)
	return
for i in range(len(s) - 25):
	ss = s[i:i + 26]
	q = 0
	switch = [0] * 26
	for k in ss:
		if k == '?':
			q += 1
		else:
			switch[ord(k) - base] = 1
	if 26 - sum(switch) <= q:
		sl = list(ss)
		for ii in range(26):
			if sl[ii] == '?':
				for j in range(26):
					if switch[j] == 0:
						switch[j] = 1
						sl[ii] = chr(base + j)
						break
		news = s[0:i].replace('?', 'A') + ''.join(sl) + s[i + 26:].replace('?', 'A')
		print(news)
		return
print(-1)
return


from sys import stdin
from string import ascii_uppercase
hat = stdin.readlines()
words = hat[0].strip()
myword = list(words)
substrings = []
for i in range(0, len(myword) - 25):
	substrings.append(myword[i:i + 26])

def solve(word):
	lst = []
	letters = ascii_uppercase
	for i in range(len(word)):
		if word[i] != '?':
			lst.append(word[i])
	if len(lst) == len(set(lst)):
		for i in range(len(word)):
			if word[i] == '?':
				for j in letters:
					if j not in word:
						word[i] = j
		return ''.join(word)
	else:
		return -1
for i in range(len(substrings)):
	if solve(substrings[i]) != -1:
		myword = list(''.join(myword[0:i]) + solve(substrings[i]) + ''.join(myword[i + 26:]))
		for j in range(len(myword)):
			if myword[j] == '?':
				myword[j] = 'A'
		print(''.join(myword))
		quit()
print(-1)


from collections import Counter
word_template = list(input())
if len(word_template) < 26:
	print(-1)
	exit()
for substring_idx in range(0, len(word_template) - 25):
	counter = Counter(word_template[substring_idx:substring_idx + 26])
	del counter['?']
	if max(counter.values(), default=1) == 1:
		all_letters = list('QWERTYUIOPASDFGHJKLZXCVBNM')
		missing_letters = all_letters - counter.keys()
		missing_letters_it = iter(list(missing_letters))
		word_template[substring_idx:substring_idx + 26] = [x if x != '?' else next(missing_letters_it) for x in word_template[substring_idx:substring_idx + 26]]
		word_template = [x if x != '?' else 'A' for x in word_template]
		print(''.join(word_template))
		exit()
print(-1)


data = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s = list(input())
if len(s) < 26:
	print(-1)
	exit()
d = dict()
flag = 1
ans = 0
for i in range(0, len(s) - 26 + 1):
	for j in range(i, i + 26):
		if s[j] in d:
			flag = 0
			d.clear()
			break
		elif s[j] != '?':
			d[s[j]] = 1
	if flag:
		ans = 1
		for x in range(i, i + 26):
			if s[x] == '?':
				for l in data:
					if l not in d:
						d[l] = 1
						s[x] = l
						break
		break
	else:
		flag = 1
if ans:
	for z in range(len(s)):
		if s[z] == '?':
			s[z] = 'A'
	print(''.join(s))
else:
	print(-1)


s = input()
s = list(s)
n = len(s)
if n < 26:
	print(-1)
	exit()
ch = 0
for i in range(n - 25):
	st = set(s[i:i + 26])
	if '?' in st:
		st.remove('?')
	if len(st) + s[i:i + 26].count('?') == 26:
		ch = 1
		if s[i:i + 26].count('?') == 0:
			break
		k = 65
		for j in range(i, i + 26):
			if s[j] == '?':
				while True:
					if chr(k) not in s[i:i + 26]:
						s[j] = chr(k)
						k += 1
						break
					else:
						k += 1
for i in range(n):
	if s[i] == '?':
		s[i] = 'A'
if ch == 0:
	print(-1)
else:
	print(*s, sep='')


a = list(input())
count = [0 for _ in range(26)]
avilable = [0 for _ in range(26)]
miss = []
temp = []
check = 0
if len(a) < 26:
	print(-1)
else:
	undefind = 0
	for i in range(26):
		if a[i] == '?':
			miss.append(i)
		else:
			count[ord(a[i]) - 65] += 1
			avilable[ord(a[i]) - 65] = 1
	if sum(avilable) + len(miss) == 26:
		check = 1
		temp = miss[:]
	idex = 0
	if len(a) > 26:
		for i in range(26, len(a)):
			if not check:
				if a[idex] == '?':
					miss.pop(0)
					a[idex] = 'A'
				else:
					count[ord(a[idex]) - 65] -= 1
					if count[ord(a[idex]) - 65] < 1:
						avilable[ord(a[idex]) - 65] = 0
				if a[i] == '?':
					miss.append(i)
				else:
					count[ord(a[i]) - 65] += 1
					avilable[ord(a[i]) - 65] = 1
				idex += 1
				if sum(avilable) + len(miss) == 26:
					check = 1
					temp = miss[:]
			elif a[i] == '?':
				a[i] = 'A'
	if check:
		for i in range(26):
			if avilable[i] == 0:
				a[temp.pop(0)] = chr(i + 65)
		print(''.join(a))
	else:
		print(-1)


s = input()
found = False
for i in range(len(s) - 25):
	substring = s[i:i + 26]
	each_once = True
	for letter in substring:
		if letter != '?' and substring.count(letter) > 1:
			each_once = False
			break
	if each_once:
		found = True
		missing_letters = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ') - set(substring)
		for each in missing_letters:
			substring = substring.replace('?', each, 1)
		s = s[:i] + substring + s[i + 26:]
		break
if found:
	print(s.replace('?', 'A'))
else:
	print(-1)


def complete(start, end, s):
	ans = []
	for i in range(start):
		if s[i] == '?':
			ans.append('A')
		else:
			ans.append(s[i])
	used = set(s[start:end + 1])
	for i in range(start, end + 1):
		if s[i] == '?':
			for i in range(26):
				if chr(ord('A') + i) not in used:
					ans.append(chr(ord('A') + i))
					used.add(chr(ord('A') + i))
					break
		else:
			ans.append(s[i])
	for i in range(end + 1, len(s)):
		if s[i] == '?':
			ans.append('A')
		else:
			ans.append(s[i])
	return ''.join(ans)

def fun(s):
	(start, end) = (0, 0)
	if len(s) < 26:
		return False
	array = [0 for i in range(26)]
	flag = True
	while start <= end and end < len(s):
		curr = s[end]
		if curr == '?':
			if end - start >= 25:
				return complete(start, end, s)
			end += 1
			continue
		array[ord(curr) - ord('A')] += 1
		while array[ord(curr) - ord('A')] > 1:
			temp = s[start]
			array[ord(temp) - ord('A')] -= 1
			start += 1
		if end - start >= 25:
			return complete(start, end, s)
		end += 1
	return []
s = input()
ans = fun(s)
if ans:
	print(ans)
else:
	print(-1)


s = list(input())
n = len(s)
d = dict()
for i in range(n):
	d[s[i]] = d.get(s[i], 0) + 1
	if i >= 26:
		d[s[i - 26]] -= 1
		if d[s[i - 26]] == 0:
			d.pop(s[i - 26])
	if i >= 25:
		x = d.get('?', 0)
		if x == 0:
			if len(d) == 26:
				for j in range(n):
					if s[j] == '?':
						s[j] = 'A'
				print(''.join(s))
				exit(0)
		elif x + len(d) - 1 == 26:
			y = []
			for z in range(26):
				Z = chr(z + ord('A'))
				if Z not in d:
					y.append(Z)
			for j in range(26):
				if s[i - j] == '?':
					s[i - j] = y[0]
					y = y[1:]
			for j in range(n):
				if s[j] == '?':
					s[j] = 'A'
			print(''.join(s))
			exit(0)
print(-1)


def poss(ss):
	prr = [0 for i in range(26)]
	ques = 0
	for x in ss:
		if x == '?':
			ques += 1
		else:
			prr[ord(x) - 65] = 1
	return sum(prr) + ques == 26

def make(ss):
	prr = [0 for i in range(26)]
	for x in ss:
		if x != '?':
			prr[ord(x) - 65] = 1
	ans = ''
	for x in ss:
		if x == '?':
			for i in range(26):
				if prr[i] == 0:
					ans += chr(i + 65)
					prr[i] = 1
					break
		else:
			prr[ord(x) - 65] = 1
			ans += x
	return ans
s = input()
l = len(s)
if l < 26:
	print(-1)
else:
	ans = ''
	i = 26
	suc = 0
	while i <= l:
		if poss(s[i - 26:i]):
			ans += make(s[i - 26:i])
			suc = 1
			break
		elif s[i - 26] == '?':
			ans += 'A'
		else:
			ans += s[i - 26]
		i += 1
	for j in range(i, l):
		if s[j] == '?':
			ans += 'A'
		else:
			ans += s[j]
	if suc:
		print(ans)
	else:
		print(-1)


s = input()
for i in range(len(s) - 25):
	sub = s[i:i + 26]
	msg = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ') - set(sub)
	if len(msg) == sub.count('?'):
		while msg:
			sub = sub.replace('?', msg.pop(), 1)
		print((s[:i] + sub + s[i + 26:]).replace('?', 'A'))
		break
else:
	print(-1)


import sys
s = input()
s2 = ''
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
yes = no = 0
if len(s) < 26:
	no = 1
else:
	for i in range(len(s) - 25):
		store = [0] * 26
		q = pos = start = 0
		for j in range(i, i + 26):
			start = i
			if s[j] == '?':
				q += 1
			else:
				pos = ord(s[j]) - 65
				if store[pos] == 0:
					store[pos] += 1
				else:
					break
		if store.count(1) + q == 26:
			yes = 1
			break
	for i in range(len(s)):
		if i >= start and i <= start + 25:
			if s[i] != '?':
				s2 += s[i]
			else:
				newvalue = store.index(0) + 65
				s2 += chr(newvalue)
				store[store.index(0)] = 1
		elif s[i] != '?':
			s2 += s[i]
		else:
			s2 += 'A'
if yes == 1 and no == 0:
	print(s2)
else:
	print('-1')


s = input()
word = list(s)
correct = False
for i in range(len(s) - 25):
	arr = [0] * 26
	empty = set(range(65, 65 + 26))
	correct = True
	for j in range(26):
		c = s[i + j]
		if c != '?':
			val = ord(c)
			if val not in empty:
				correct = False
				break
			else:
				empty.remove(val)
	if correct:
		for j in range(26):
			if word[i + j] == '?':
				word[i + j] = chr(empty.pop())
	if correct:
		break
if correct:
	word = ''.join(['A' if x == '?' else x for x in word])
	print(word)
else:
	print(-1)


line = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
d = dict()
for i in range(26):
	d[alpha[i]] = 0
l = 0
r = 0
f = False
while r < len(line):
	if line[r] != '?':
		while d[line[r]] > 0 or r - l > 25:
			if line[l] != '?':
				d[line[l]] -= 1
			l += 1
		d[line[r]] = 1
	if r - l == 25:
		f = True
		break
	r += 1
if f:
	t = [i for i in line[l:r + 1]]
	j = 0
	for i in range(26):
		if t[i] == '?':
			while d[alpha[j]] > 0:
				j += 1
			t[i] = alpha[j]
			d[alpha[j]] = 1
	ans = ''
	for i in range(l):
		if line[i] == '?':
			ans += 'A'
		else:
			ans += line[i]
	ans += ''.join(t)
	for i in range(r + 1, len(line)):
		if line[i] == '?':
			ans += 'A'
		else:
			ans += line[i]
	print(ans)
else:
	print(-1)


S = input()
if len(S) < 26:
	print(-1)
else:
	d = []
	o = 0
	D = []
	B = False
	for j in range(len(S)):
		if len(D) == 26:
			B = True
			break
		D = []
		d = []
		if len(S[j:j + 26]) < 26:
			break
		for i in S[j:j + 26]:
			if i == '?':
				D.append(i)
			elif i not in d:
				d.append(i)
				D.append(i)
			else:
				if len(D) == 26:
					B = True
					o = j
					break
				D = []
				d = []
			if len(D) == 26:
				B = True
				o = j
				break
	if B == False:
		print(-1)
	else:
		L = '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'
		L = L.split()
		l = []
		for i in L:
			if i not in d:
				l.append(i)
		i = 0
		for j in range(len(S)):
			if j >= o and j <= o + 25:
				if S[j] == '?':
					print(l[i], sep='', end='')
					i += 1
				else:
					print(S[j], sep='', end='')
			elif S[j] == '?':
				print('A', end='')
			else:
				print(S[j], sep='', end='')


import sys
input = sys.stdin.readline
read_tuple = lambda _type: map(_type, input().split(' '))
from string import ascii_uppercase

def is_good_possible(counts):
	return sum((counts[k] == 1 for k in ascii_uppercase)) + counts['?'] == 26

def make_good(counts, substring):
	chars_left = set(ascii_uppercase) - set((k for k in counts if counts[k] == 1))
	for i in range(len(substring)):
		if substring[i] == '?':
			substring[i] = chars_left.pop()
	return substring

def solve():
	s = list(input().replace('\n', ''))
	n = len(s)
	if n < 26:
		return -1
	counts = {k: 0 for k in ascii_uppercase}
	counts['?'] = 0
	for i in range(26):
		counts[s[i]] += 1
	if is_good_possible(counts):
		return ''.join(make_good(counts, s[:26])) + ''.join(s[26:]).replace('?', 'A')
	for i in range(1, n + 1 - 26):
		counts[s[i - 1]] -= 1
		counts[s[i + 25]] += 1
		if is_good_possible(counts):
			prefix = ''.join(s[:i]).replace('?', 'A')
			substring = s[i:i + 26]
			postfix = ''.join(s[i + 26:]).replace('?', 'A')
			return prefix + ''.join(make_good(counts, substring)) + postfix
	return -1
print(solve())


s = input()
notfound = True
if len(s) >= 26:
	d = {'?': 0}
	for ch in s[:26]:
		if ch != '?':
			if ch in d:
				d[ch] += 1
			else:
				d[ch] = 1
	for i in range(len(s) - 25):
		if max(d.values()) < 2:
			ss = list(s[i:i + 26])
			fill = list(filter(lambda c: c not in d or d[c] == 0, [chr(i + ord('A')) for i in range(26)]))
			for k in range(26):
				if ss[k] == '?':
					ss[k] = fill.pop()
			print(s[:i].replace('?', 'A'), end='')
			print(''.join(ss), end='')
			print(s[i + 26:].replace('?', 'Z'))
			notfound = False
			break
		if i < len(s) - 26:
			ch = s[i]
			if ch != '?':
				d[ch] -= 1
			ch = s[i + 26]
			if ch != '?':
				if ch in d:
					d[ch] += 1
				else:
					d[ch] = 1
if notfound:
	print(-1)


s = list(input())
n = len(s)
d = {}
i = j = l = 0
abc = set(list('ABCDEFGHIJKLMNOPQRZTUVWXYS'))
while i < n:
	d[s[i]] = d.get(s[i], 0) + 1
	if d[s[i]] > 1 and s[i] != '?':
		while d[s[i]] != 1:
			d[s[j]] -= 1
			if d[s[j]] == 0:
				del d[s[j]]
			j += 1
			l -= 1
	i += 1
	l += 1
	if l == 26:
		break
if l == 26:
	z = set(abc - set(s[j:i]))
	for k in range(j, i):
		if s[k] == '?':
			s[k] = z.pop()
	a = ''.join(s)
	a = a.replace('?', 'A')
	print(a)
else:
	print(-1)


def niceable(a):
	p = 26 * [0]
	for i in range(26):
		if a[i] != '?':
			p[ord(a[i]) - ord('A')] += 1
	z = p.count(0)
	a = list(a)
	zz = a.count('?')
	if z > zz:
		return -1
	else:
		x = ''
		for i in a:
			if i == '?':
				try:
					jj = p.index(0)
					x += chr(ord('A') + jj)
					p[jj] = 1
				except:
					x += 'A'
			else:
				x += i
		return x
n = input()
if len(n) < 26:
	print(-1)
else:
	a = 26 * [0]
	h = 0
	for i in range(len(n) - 25):
		z = niceable(n[i:i + 26])
		if z != -1:
			print((n[:i] + z + n[i + 26:]).replace('?', 'A'))
			h = 1
			break
	if h == 0:
		print(-1)


from string import ascii_uppercase as alph

def total():
	ans = un
	for q in letters.values():
		if q >= 1:
			ans += 1
	return ans

def printAns(pref, s, suff):
	print(pref.replace('?', 'A'), end='')
	needed = []
	for (lett, q) in letters.items():
		if q == 0:
			needed.append(lett)
	for lett in s:
		if lett == '?':
			print(needed.pop(), end='')
		else:
			print(lett, end='')
	print(suff.replace('?', 'B'))
s = input()
letters = dict()
for lett in alph:
	letters[lett] = 0
un = 0
for i in range(min(len(s), 26)):
	if s[i] == '?':
		un += 1
	else:
		letters[s[i]] += 1
if total() == 26:
	printAns('', s[:26], s[26:])
else:
	for i in range(26, len(s)):
		if s[i] == '?':
			un += 1
		else:
			letters[s[i]] += 1
		if s[i - 26] == '?':
			un -= 1
		else:
			letters[s[i - 26]] -= 1
		if total() == 26:
			printAns(s[:i - 25], s[i - 25:i + 1], s[i + 1:])
			break
	else:
		print(-1)


import sys
import collections
string = [i for i in sys.stdin.readline()[:-1]]
left = 0
distinct = set()
ch = []
qm = 0
upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
flag = 0
for (right, char) in enumerate(string, 1):
	if char.isalpha():
		distinct.add(char)
		ch.append(char)
	else:
		qm += 1
	dist = right - left
	if dist == 26:
		if len(distinct) + qm == 26:
			for i in range(left, right):
				if string[i] == '?':
					for c in upper:
						if c not in distinct:
							string[i] = c
							distinct.add(c)
							break
			flag = 1
			break
		else:
			if string[left].isalpha():
				ch.remove(string[left])
				if string[left] not in ch:
					distinct.remove(string[left])
			else:
				qm -= 1
			left += 1
if flag:
	for (i, char) in enumerate(string):
		if char == '?':
			string[i] = 'B'
	print(''.join(string))
else:
	print(-1)


s = list(input())
b = set('QWERTYUIOPASDFGHJKLZXCVBNM')
n = len(s)
cout = 0
item = s[:25].count('?')
for (i, x) in enumerate(s[:-25]):
	if s[i + 25] == '?':
		item += 1
	a = set(s[i:i + 26]) | {'?'}
	if len(a) + item == 27:
		lst = list(b - a)
		for (j, y) in enumerate(s[i:i + 26]):
			if y == '?':
				s[i + j] = lst.pop()
		res = ''.join(s)
		print(res.replace('?', 'A'))
		from sys import exit
		exit()
	if s[i] == '?':
		item -= 1
print(-1)


word = input()
occurrences = [0 for i in range(26)]
question_marks_count = 0

def fill_substring(word):
	available_chars = {ord(char) for char in word if char != '?'}
	unavailable_chars = {i for i in range(ord('A'), ord('Z') + 1)} - available_chars
	return ''.join([char if char != '?' else chr(unavailable_chars.pop()) for char in word])

def fill_with_A(word):
	return ''.join([char if char != '?' else 'A' for char in word])
if len(word) < 26:
	print(-1)
else:
	for char in word[:26]:
		if char == '?':
			question_marks_count += 1
		else:
			occurrences[ord(char) - 65] += 1
			if occurrences[ord(char) - 65] == 1:
				question_marks_count += 1
	if question_marks_count == 26:
		print(fill_substring(word[:26]) + fill_with_A(word[26:]))
		exit()
	for i in range(26, len(word)):
		char_to_remove = word[i - 26]
		char_to_add = word[i]
		if char_to_remove == '?':
			question_marks_count -= 1
		else:
			occurrences[ord(char_to_remove) - 65] -= 1
			if occurrences[ord(char_to_remove) - 65] == 0:
				question_marks_count -= 1
		if char_to_add == '?':
			question_marks_count += 1
		else:
			occurrences[ord(char_to_add) - 65] += 1
			if occurrences[ord(char_to_add) - 65] == 1:
				question_marks_count += 1
		if question_marks_count == 26:
			print(fill_with_A(word[:i - 25]) + fill_substring(word[i - 25:i + 1]) + fill_with_A(word[i + 1:]))
			exit()
	print(-1)


from collections import Counter
from string import ascii_uppercase
s = input()
counter = Counter(s[:25])
for j in range(25, len(s)):
	counter[s[j]] += 1
	if j >= 26:
		counter.subtract(s[j - 26])
	q = []
	for l in ascii_uppercase:
		if counter[l] == 0:
			q.append(l)
	if counter['?'] < len(q):
		continue
	else:
		output = ''
		i = 0
		for c in s[:j - 25]:
			if c == '?':
				output += 'A'
			else:
				output += c
		for c in s[j - 25:j + 1]:
			if c == '?':
				output += q[i]
				i += 1
			else:
				output += c
		for c in s[j + 1:]:
			if c == '?':
				output += 'A'
			else:
				output += c
		print(output)
		exit()
print('-1')


s = input()
l = len(s)
s2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
c = 0
g = 0
for i in range(l - 1, 24, -1):
	s1 = s[i - 25:i + 1]
	d = [0] * 26
	f = 0
	ques = 0
	for j in s1:
		if j != '?':
			id = ord(j) - 65
			if d[id] == 1:
				f = 1
				break
			else:
				d[id] = 1
		else:
			ques += 1
	if f == 1:
		continue
	elif sum(d) + ques == 26:
		g = 1
		sf = ''
		d1 = [j for j in range(26) if d[j] == 0]
		z = 0
		for j in s1:
			if j != '?':
				sf += j
			else:
				sf += chr(d1[z] + 65)
				z += 1
		s = s.replace('?', 'A')
		print(s[:i - 25] + sf + s[i + 1:])
		break
if g == 0:
	print(-1)


a = ['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']
s = list(input())
(x, y, k) = (0, 0, 0)
if len(s) < 26:
	print(-1)
else:
	for i in range(len(s) - 26 + 1):
		t = list()
		for j in a:
			if s[i:i + 26].count(j) > 1:
				x = 1
				break
			elif not s[i:i + 26].count(j):
				t.append(j)
		if x:
			x = 0
		elif s[i:i + 26].count('?') == len(t):
			k = 1
			for j in range(i, i + 26):
				if s[j] == '?':
					s[j] = t[y]
					y += 1
			break
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'A'
	if k:
		print(''.join(s))
	else:
		print(-1)


def solve():
	v = set([chr(i) for i in range(65, 91)])
	l = list(input())
	n = len(l)
	if n < 26:
		print(-1)
		return
	for i in range(n):
		s = l[i:i + 26]
		z = set(s)
		z.add('?')
		if len(z) + s.count('?') - 1 == 26:
			q = list(v - z)
			for j in range(26):
				if l[i + j] == '?':
					l[i + j] = q.pop()
			print(''.join(l).replace('?', 'X'))
			return
	print(-1)
solve()


def check(s):
	for i in range(len(s)):
		for j in range(i + 1, len(s)):
			if s[j] == s[i] and s[j] != '?':
				return -1
	return 1
from collections import deque
from string import ascii_uppercase
w = deque(ascii_uppercase)
s = input()
n = len(s)
flag = False
for i in range(len(s) - 25):
	k = i
	s2 = list(s[i:i + 26])
	if check(s2) == 1:
		flag = True
		for k1 in range(len(s2)):
			if s2[k1] != '?':
				w.remove(s2[k1])
		for k2 in range(len(s2)):
			if s2[k2] == '?':
				s2[k2] = w[0]
				w.remove(s2[k2])
		break
if flag == False:
	print('-1')
else:
	s = list(s)
	s[k:k + 26] = s2
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'A'
	for x in s:
		print(x, end='')
	print()


def good(s):
	f = dict()
	for i in s:
		if f.get(i):
			return False
		if i != '?':
			f[i] = 1
	return True

def fix(s):
	f = dict()
	for i in s:
		if i != '?':
			f[i] = 1
	ans = ''
	e = 'A'
	for i in s:
		if i != '?':
			ans += i
		else:
			while f.get(e):
				e = chr(ord(e) + 1)
			ans += e
			e = chr(ord(e) + 1)
	return ans

def gog(s):
	a = ''
	for i in s:
		if i != '?':
			a += i
		else:
			a += 'A'
	return a
s = input()
gg = -1
for i in range(0, len(s) - 25):
	if good(s[i:i + 26]):
		gg = i
		break
if gg >= 0:
	ans = gog(s[:i]) + fix(s[i:i + 26]) + gog(s[i + 26:])
else:
	ans = -1
print(ans)


import collections

def solve(word):
	dictionary = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	freq = collections.defaultdict(int)
	if len(word) < 26:
		return -1
	n = len(word)
	flag = False
	for i in range(n - 26 + 1):
		for j in range(i, i + 26):
			if word[j] != '?':
				freq[word[j]] += 1
		if all((freq[c] <= 1 for c in dictionary)):
			for j in range(i, i + 26):
				temp = word[i:i + 26]
				if word[j] == '?':
					for c in dictionary:
						if c not in temp:
							word[j] = c
			flag = True
			break
		freq = collections.defaultdict(int)
	if flag:
		for i in range(len(word)):
			if word[i] == '?':
				word[i] = 'S'
		return ''.join(word)
	else:
		return -1
word = str(input())
word = list(word)
print(solve(word))


s = input()
left = 0
counter = 0
arr = [0] * 26
if len(s) < 26:
	print(-1)
else:
	for i in range(len(s)):
		c = s[i]
		if s[i] != '?':
			while arr[ord(s[i]) - ord('A')] == 1:
				if s[left] != '?':
					arr[ord(s[left]) - ord('A')] = 0
				left = left + 1
				counter -= 1
			arr[ord(s[i]) - ord('A')] = 1
		counter += 1
		if counter == 26:
			break
	if counter == 26:
		guesses = []
		for i in range(26):
			if arr[i] != 1:
				guesses.append(chr(i + ord('A')))
		characters = []
		for i in range(len(s)):
			sdd = s[i]
			if i < left or i > left + 25:
				if s[i] == '?':
					characters.append('A')
				else:
					characters.append(s[i])
			elif s[i] == '?':
				characters.append(guesses.pop())
			else:
				characters.append(s[i])
		print(''.join(characters))
	else:
		print(-1)


s = input()
f = False
for i in range(len(s) - 25):
	subs = s[i:i + 26]
	q = False
	for j in subs:
		if j == '?':
			continue
		elif subs.count(j) > 1:
			q = True
			break
	if q:
		continue
	else:
		f = True
		u = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for j in u:
			if j not in subs:
				subs = subs[:subs.find('?')] + j + subs[subs.find('?') + 1:]
		s = s[:i] + subs + s[i + 26:]
		break
if f:
	s = s.replace('?', 'A')
	print(s)
else:
	print(-1)


import sys, os
from io import BytesIO, IOBase
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True

def isNice(s):
	cnt = [0 for i in range(26)]
	for c in s:
		if c != '?':
			cnt[ord(c) - ord('A')] += 1
	if max(cnt) <= 1:
		return True

def fill(s):
	notTaken = set(S2)
	for c in s:
		if c != '?':
			notTaken.remove(c)
	for i in range(26):
		if s[i] == '?':
			s[i] = notTaken.pop()
	return s
s = list(inp())
n = len(s)
flg = False
for i in range(n - 25):
	if isNice(s[i:i + 26]):
		flg = True
		s[i:i + 26] = fill(s[i:i + 26])
		break
print(''.join(s).replace('?', 'A') if flg else -1)


s = input()
t = [ord(c) - 65 for c in s]
solved = False
for i in range(len(t) - 25):
	tp = t[i:i + 26]
	l = []
	for k in range(26):
		if tp.count(k) == 0:
			l += [k]
		if tp.count(k) > 1:
			break
	else:
		if not solved:
			solved = True
			for j in range(i):
				print(s[j] if s[j] != '?' else 'A', end='')
			c = 0
			for j in range(i, i + 26):
				if s[j] != '?':
					print(s[j], end='')
				else:
					print(chr(l[c] + 65), end='')
					c += 1
			for j in range(i + 26, len(t)):
				print(s[j] if s[j] != '?' else 'A', end='')
if not solved:
	print(-1)


s = input()
s = str(s)
l = []
count = 0
t = [0, 0]
for i in range(0, len(s)):
	if count == 26:
		break
	if s[i] in l and s[i] != '?':
		x = l.index(s[i])
		if x == 0:
			l = l[1:]
		else:
			l = l[x + 1:]
		l.append(s[i])
		count -= x
		t[0] = i - count + 1
	else:
		l.append(s[i])
		count += 1
	t[1] = i
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
k = 0
if count == 26:
	for q in range(0, t[0]):
		if s[q] == '?':
			print(alp[k], end='')
		else:
			print(s[q], end='')
	for j in range(0, len(l)):
		if l[j] == '?':
			while True:
				if alp[k] not in l:
					l[j] == alp[k]
					break
				else:
					k += 1
			l[j] = alp[k]
	for r in range(0, len(l)):
		print(l[r], end='')
	for w in range(t[1] + 1, len(s)):
		if s[w] == '?':
			print(alp[k], end='')
		else:
			print(s[w], end='')
else:
	print(-1)


from collections import Counter
word = 'a' + input()
a = ord('A')
letters = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans = ''
cnt = Counter(word[:26])
for i in range(1, len(word) - 25):
	cnt[word[i + 25]] += 1
	cnt[word[i - 1]] -= 1
	jollies = cnt['?']
	_sum = jollies
	for e in letters:
		if cnt[e] > 1:
			break
		_sum += cnt[e]
	else:
		if _sum == 26:
			pool = letters - set(word[i:i + 26])
			replaced = ''
			for j in range(i, i + 26):
				if word[j] == '?':
					replaced += pool.pop()
				else:
					replaced += word[j]
			else:
				ans += replaced
				ans += word[i + 26:]
				ans = str.replace(ans, '?', 'A')
				print(ans)
				exit()
	ans += word[i]
print(-1)


s = input()
l = len(s)
if l < 26:
	print(-1)
	exit()
s = list(s)
w = ord('A')
a = [0] * 26
r = 0
while r + 26 <= l:
	g = 1
	for i in range(r, r + 26):
		if s[i] != '?':
			if a[ord(s[i]) - w] == 0:
				a[ord(s[i]) - w] = 1
			else:
				a = [0] * 26
				r = r + 1
				g = 0
				break
	if g == 1:
		m = 0
		for k in range(r, r + 26):
			if s[k] == '?':
				while a[m] != 0:
					m = m + 1
				s[k] = chr(w + m)
				m = m + 1
		for i in range(l):
			if s[i] == '?':
				s[i] = 'A'
		print(''.join(s))
		exit()
print(-1)


import sys
import string
from collections import defaultdict
from functools import lru_cache
from collections import Counter

def mi(s):
	return map(int, s.strip().split())

def lmi(s):
	return list(mi(s))

def mf(f, s):
	return map(f, s)

def lmf(f, s):
	return list(mf(f, s))

def main(s):
	begin = 0
	counts = defaultdict(int)
	have = set()
	num_q = 0
	qs = []
	for i in range(len(s)):
		if s[i] == '?':
			num_q += 1
		else:
			counts[s[i]] += 1
			have.add(s[i])
		if i - begin + 1 > 26:
			if s[begin] == '?':
				num_q -= 1
			else:
				counts[s[begin]] -= 1
				if counts[s[begin]] == 0:
					have.remove(s[begin])
			begin += 1
		if num_q + len(have) == 26:
			for c in string.ascii_uppercase:
				if c not in have:
					qs.append(c)
			break
	if num_q + len(have) < 26:
		print(-1)
		return
	ans = []
	k = 0
	for (e, c) in enumerate(s):
		if c != '?':
			ans.append(c)
		elif e >= begin and e <= i:
			ans.append(qs[k])
			k += 1
		else:
			ans.append('A')
	print(''.join(ans))
for (e, line) in enumerate(sys.stdin.readlines()):
	arr = line.strip()
main(arr)


import math
q = 1
for _ in range(q):
	s = list(input())
	n = len(s)
	flag = False
	file = []
	for i in range(n - 25):
		l = s[i:i + 26]
		k = [0] * 26
		ques = 0
		for j in range(26):
			if l[j] != '?':
				k[ord(l[j]) - 65] += 1
			else:
				ques += 1
		if max(k) == 1 or ques == 26:
			flag = True
			check = i
			file = k
			break
		else:
			continue
	if flag:
		k = 0
		for i in range(check, check + 26):
			for j in range(k, 26):
				if s[i] == '?':
					if file[j] == 0:
						s[i] = chr(65 + j)
						k = j + 1
		for i in range(n):
			if s[i] == '?':
				s[i] = 'A'
		print(''.join(s))
	else:
		print(-1)


fr = dict()
for order in range(ord('A'), ord('Z') + 1):
	fr[chr(order)] = 0
s = list(input())
zeros = set([chr(order) for order in range(ord('A'), ord('Z') + 1)])
q_marks = set()
i = j = 0
answer_found = False
while j < len(s):
	if s[j] == '?':
		q_marks.add(j)
	else:
		fr[s[j]] += 1
		if fr[s[j]] == 1:
			zeros.remove(s[j])
	if j - i + 1 == 26:
		if len(zeros) == len(q_marks):
			answer_found = True
			break
		if s[i] == '?':
			q_marks.remove(i)
		else:
			fr[s[i]] -= 1
			if fr[s[i]] == 0:
				zeros.add(s[i])
		i += 1
	j += 1
if answer_found:
	for k in range(0, i):
		if s[k] == '?':
			s[k] = 'A'
	for k in range(j + 1, len(s)):
		if s[k] == '?':
			s[k] = 'A'
	for (index, char) in zip(q_marks, sorted(zeros)):
		s[index] = char
	print(''.join(s))
else:
	print(-1)


from string import ascii_uppercase

def check_26_letters(string: str):
	number_of_gaps = string.count('?')
	l = len(set(string))
	if number_of_gaps > 0:
		if l - 1 + number_of_gaps == 26:
			return (True, number_of_gaps)
		else:
			return (False, number_of_gaps)
	elif l == 26:
		return (True, number_of_gaps)
	else:
		return (False, number_of_gaps)

def fill_gaps(string: str, number_of_gaps):
	l_string = list(string)
	to_fill = iter(set(ascii_uppercase) - (set(ascii_uppercase) & set(string)))
	for _ in range(number_of_gaps):
		index = l_string.index('?')
		l_string[index] = next(to_fill)
	return ''.join(l_string)

def fill_gaps_with_a(string: str):
	return string.replace('?', 'A')
s = input()
size = len(s)
if size < 26:
	print(-1)
else:
	(left, right) = (0, 26)
	while right <= size:
		(success, n) = check_26_letters(s[left:right])
		if success:
			print(fill_gaps_with_a(s[:left]) + fill_gaps(s[left:right], n) + fill_gaps_with_a(s[right:]))
			break
		left += 1
		right += 1
	else:
		print(-1)


s = list(input().strip())
l = []
length = len(s)
for i in range(26):
	l.append(0)
if length < 26:
	print(-1)
else:
	for i in range(26):
		if s[i] != '?':
			l[ord(s[i]) - 65] += 1
	current = 0
	flag = 1
	for i in range(length - 25):
		for j in range(26):
			if l[j] != 0 and l[j] != 1:
				flag = 0
				break
		if flag == 1:
			index = 0
			for k in range(current, current + 26):
				if s[k] == '?':
					for m in range(index, 26):
						if l[m] == 0:
							s[k] = chr(m + 65)
							index = m + 1
							break
			for k in range(length):
				if s[k] == '?':
					s[k] = 'A'
			break
		elif i != length - 26:
			if s[current] != '?':
				l[ord(s[current]) - 65] -= 1
			asd = min(current + 26, length - 1)
			if s[asd] != '?':
				l[ord(s[asd]) - 65] += 1
			current += 1
			flag = 1
	if flag == 0:
		print(-1)
	else:
		str = ''
		for i in range(length):
			str += s[i]
		print(str)


word = input().lower()
if len(word) < 26:
	print(-1)
	exit()
alpha = ['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm']
for i in range(len(word) - 26 + 1):
	cnt = 0
	used = []
	for char in alpha:
		if word[i:i + 26].count(char) == 1:
			used.append(char)
		if word[i:i + 26].count(char) < 2:
			cnt += 1
		if word[i:i + 26].count(char) >= 2:
			cnt -= 500000
			break
		cnt -= 1
	if cnt == 0:
		unused = []
		for lt in alpha:
			if lt not in used:
				unused.append(lt)
		word_new = ''
		unusedforthenonparttho = unused
		for x in range(i):
			if word[x] == '?':
				word_new += unusedforthenonparttho[0]
			else:
				word_new += word[x]
		for x in range(i, i + 26):
			if word[x] == '?':
				word_new += unused.pop(-1)
			else:
				word_new += word[x]
		for x in range(i + 26, len(word)):
			if word[x] == '?':
				word_new += word_new[i]
			else:
				word_new += word[x]
		print(word_new.upper())
		exit()
print(-1)


s = input()
if len(s) < 26:
	print(-1)
else:
	key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ?'
	letters = dict()
	x = list(s)
	found = False
	for i in range(0, len(x) - 25):
		oneCount = 0
		zeroCount = 0
		qCount = 0
		for j in key:
			letters[j] = 0
		for j in range(i, i + 26):
			letters[x[j]] += 1
		for j in letters:
			if letters[j] == 1 and j.isalpha():
				oneCount += 1
			elif letters[j] == 0 and j.isalpha():
				zeroCount += 1
			elif j == '?':
				qCount += letters[j]
		if qCount != zeroCount or oneCount + zeroCount != 26:
			continue
		else:
			for k in range(i, i + 26):
				if x[k] == '?':
					for j in letters:
						if letters[j] == 0 and j.isalpha():
							x[k] = j
							letters[j] += 1
							break
			for k in range(len(x)):
				if x[k] == '?':
					x[k] = 'A'
			print(''.join(x))
			found = True
			break
	if found == False:
		print(-1)


s = input()
if len(s) < 26:
	print('-1')
	quit()
possible = False
for i in range(len(s) - 25):
	cur = ''
	possible = True
	for j in range(i, i + 26):
		if s[j] in cur:
			possible = False
			break
		elif s[j] != '?':
			cur += s[j]
		else:
			cur += '*'
	if possible:
		for m in range(65, 91):
			if cur.find(chr(m)) == -1:
				cur = cur.replace('*', chr(m), 1)
		s = s.replace('?', 'Z')
		print(s[:i] + cur + s[i + 26:])
		quit()
if not possible:
	print('-1')


import sys
s = str(sys.stdin.readline())[:-1]
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = -1
if len(s) >= 26:
	tmpAns = ''
	questons = False
	letters = {}
	q = 0
	for i in range(26):
		if s[i] != '?':
			letters[s[i]] = 1
		else:
			q = q + 1
	l = len(letters)
	if l == 26:
		ans = s
	elif l + q == 26:
		havent = []
		for ch in alph:
			if not ch in letters:
				havent.append(ch)
		tmpAns = ''
		chNow = 0
		for i in range(26):
			if s[i] != '?':
				tmpAns = tmpAns + s[i]
			else:
				tmpAns = tmpAns + havent[chNow]
				chNow = chNow + 1
		ans = tmpAns + s[26:len(s)]
	else:
		i = 1
		while i <= len(s) - 26:
			letters = {}
			q = 0
			for j in range(i, i + 26):
				if s[j] != '?':
					letters[s[j]] = 1
				else:
					q = q + 1
			l = len(letters)
			if l == 26:
				ans = s
				break
			elif l + q == 26:
				havent = []
				for ch in alph:
					if not ch in letters:
						havent.append(ch)
				tmpAns = ''
				chNow = 0
				for j in range(i, i + 26):
					if s[j] != '?':
						tmpAns = tmpAns + s[j]
					else:
						tmpAns = tmpAns + havent[chNow]
						chNow = chNow + 1
				ans = s[0:i] + tmpAns + s[i + 26:len(s)]
				break
			i = i + 1
if ans != -1:
	print(ans.replace('?', 'A'))
else:
	print(ans)


import sys
import string
letters = string.ascii_uppercase

def update(part):
	result = ''
	diff = list(set(letters) - set(part))
	idx = 0
	for c in part:
		if c in letters:
			ch = c
		else:
			ch = diff[idx]
			idx += 1
		result += ch
	return result
s = input().strip()
for i in range(len(s) - 26 + 1):
	part = s[i:i + 26]
	q = part.count('?')
	diff = len(set(part)) - (1 if q > 0 else 0)
	if diff + q == 26:
		print(s[:i].replace('?', 'A') + update(part) + s[i + 26:].replace('?', 'A'))
		sys.exit(0)
print('-1')


from collections import Counter
alph = 'abcdefghijklmnopqrstuvwxyz'.upper()
s = input()
ans = ''
for i in range(len(s) - 25):
	subs = s[i:26 + i]
	d = Counter(subs)
	del d['?']
	if all((x == 1 for x in d.values())):
		subs = list(subs)
		for c in alph:
			if c in subs:
				continue
			else:
				subs[subs.index('?')] = c
		subs = ''.join(subs)
		ans = s[:i] + subs + s[26 + i:]
		ans = ans.replace('?', 'A')
		break
print(-1 if not ans else ans)


r = input()
D = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
if len(r) < 26:
	print('-1')
else:
	s = r[::-1]
	blank = 0
	flag = False
	L = 0
	R = 0
	for curr in s:
		if R > 25:
			if s[L] != '?':
				D[s[L]] -= 1
			else:
				blank -= 1
			L += 1
		if R < len(s) - 1:
			R += 1
		if curr == '?':
			blank += 1
		else:
			D[curr] += 1
		if max(D.values()) <= 1 and sum(D.values()) + blank == 26:
			if R - L == 25:
				n = s
				flag = True
				for k in range(90, 64, -1):
					if D[chr(k)] == 0:
						n = n[:L] + n[L:R + 1].replace('?', chr(k), 1) + n[R + 1:]
				n = s[:L].replace('?', 'A') + n[L:R + 1] + s[R + 1:].replace('?', 'A')
			else:
				n = s
				flag = True
				for k in range(90, 64, -1):
					if D[chr(k)] == 0:
						n = n[:L] + n[L:R].replace('?', chr(k), 1) + n[R:]
				n = s[:L].replace('?', 'A') + n[L:R] + s[R:].replace('?', 'A')
			break
	if not flag:
		print('-1')
	else:
		print(n[::-1])


import sys

def read_data():
	return next(sys.stdin).strip()

def find_good_substring(s):
	if len(s) < 26:
		return None
	(charFrq, qCnt) = (dict(), 0)
	charCnt = 0
	for (i, c) in enumerate(s):
		if c == '?':
			qCnt += 1
		else:
			charFrq[c] = charFrq.get(c, 0) + 1
			if charFrq[c] == 1:
				charCnt += 1
		if i >= 26:
			cc = s[i - 26]
			if cc == '?':
				qCnt -= 1
			else:
				charFrq[cc] -= 1
				if charFrq[cc] == 0:
					charCnt -= 1
		if i >= 25:
			if charCnt + qCnt == 26:
				return s[:i - 25].replace('?', 'Z') + good_word(s[i - 25:i + 1]) + s[i + 1:].replace('?', 'Z')

def good_word(substr):
	vocabulary = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
	vocabulary.difference_update(substr)
	wordRes = ''
	for c in substr:
		if c == '?':
			wordRes += vocabulary.pop()
		else:
			wordRes += c
	return wordRes
s = read_data()
sGood = find_good_substring(s)
print(sGood or -1)


text = input()
if len(text) < 26:
	print(-1)
	quit()
alphabet = set('ABCDEFGHIJKLMNOPQRZTUVWXYS')
cur_alphabet = dict([(s, 0) for s in 'ABCDEFGHIJKLMNOPQRZTUVWXYS?'])
for s in text[:26]:
	cur_alphabet[s] += 1

def is_good():
	c = 0
	for (key, value) in cur_alphabet.items():
		if key != '?':
			if value > 1:
				return False
			else:
				c += value
	return c + cur_alphabet['?'] == 26
if is_good():
	replace = []
	for s in alphabet:
		if cur_alphabet[s] == 0:
			replace.append(s)
	cur_text = text[0:26].replace('?', '{}').format(*replace)
	print(cur_text + text[26:].replace('?', 'A'))
	quit()
for i in range(26, len(text) + 1):
	if is_good():
		replace = []
		for s in alphabet:
			if cur_alphabet[s] == 0:
				replace.append(s)
		cur_text = text[i - 26:i].replace('?', '{}').format(*replace)
		print(text[:i - 26].replace('?', 'A') + cur_text + text[i:].replace('?', 'A'))
		quit()
	elif i < len(text):
		cur_alphabet[text[i - 26]] -= 1
		cur_alphabet[text[i]] += 1
print(-1)


from string import ascii_uppercase
s = input()
n = len(s)
for i in range(n - 25):
	qm = 0
	letters = set()
	for j in range(26):
		if s[i + j] != '?':
			letters.add(s[i + j])
		else:
			qm += 1
	if len(letters) + qm == 26:
		ex = [ascii_uppercase[i] for i in range(26) if ascii_uppercase[i] not in letters]
		ans = ''
		j = 0
		while j < n:
			if j == i:
				k = 0
				for z in range(26):
					if s[j + z] == '?':
						ans += ex[k]
						k += 1
					else:
						ans += s[j + z]
				j += 26
			else:
				if s[j] == '?':
					ans += 'A'
				else:
					ans += s[j]
				j += 1
		print(ans)
		raise SystemExit
print(-1)


import string
s = str(input())
answer = ''
for i in range(max(1, len(s) - 26) + 1):
	temp = set()
	count = 0
	current_s = list(s[i:i + 26])
	for element in current_s:
		if element == '?':
			count += 1
		else:
			temp.add(element)
	if len(temp) + count == 26:
		for j in range(26):
			if current_s[j] == '?':
				for element in list(string.ascii_uppercase):
					if element not in temp:
						temp.add(element)
						current_s[j] = element
						break
		answer += s[:i].replace('?', 'A') + ''.join(map(str, current_s)) + s[i + 26:].replace('?', 'A')
		break
if answer != '':
	print(answer)
else:
	print(-1)


s = input()
n = len(s)
for i in range(n - 25):
	cntH = []
	cntK = set()
	for j in range(i, i + 26):
		if s[j] == '?':
			cntH.append(j)
		else:
			cntK.add(s[j])
	if len(cntH) + len(cntK) == 26:
		r = []
		for t in range(i):
			if s[t] != '?':
				r.append(s[t])
			else:
				r.append('A')
		for t in range(i, i + 26):
			if s[t] != '?':
				r.append(s[t])
			else:
				for x in range(65, 91):
					if chr(x) in cntK:
						continue
					r.append(chr(x))
					cntK.add(chr(x))
					break
		for t in range(i + 26, n):
			if s[t] != '?':
				r.append(s[t])
			else:
				r.append('A')
		print(''.join(r))
		exit()
print('-1')


t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
x = list(input())
a = 0
length = len(x)
for i in range(length - 25):
	count = x[i:i + 26].count('?')
	lst = list(set(x[i:i + 26]))
	cc = lst.count('?')
	if len(lst) + count - cc == 26:
		for k in t:
			if k not in x[i:i + 26]:
				d = x[i:i + 26].index('?')
				x[i + d] = k
		x = ''.join(x).replace('?', 'A')
		print(x)
		a += 1
		break
	if a > 0:
		break
if a == 0:
	print(-1)


s = input()
if len(s) < 26:
	print(-1)
else:

	def check(so):
		for (i, c) in enumerate(so):
			if c != '?':
				if c in so[i + 1:]:
					return i
		return -1
	i = 0
	while i < len(s) - 25:
		foos = s[i:i + 26]
		r = check(foos)
		if r == -1:
			foos = list(foos)
			alIn = set(filter(lambda x: x != '?', foos))
			goal = set('QWERTYUIOPASDFGHJKLZXCVBNM')
			goal = list(goal - alIn)
			foos = list(map(lambda x: goal.pop() if x == '?' else x, foos))
			s = list(map(lambda x: 'A' if x == '?' else x, s))
			s[i:i + 26] = foos
			print(''.join(s))
			break
		else:
			i += 1 + r
	else:
		print(-1)


s = input()
n = len(s)
if n < 26:
	print(-1)
	exit()
d = [0] * 26
k = 0
for i in range(26):
	if s[i] == '?':
		k += 1
	else:
		d[ord(s[i]) - ord('A')] += 1
if sum([bool(i) for i in d]) + k == 26:
	ans = s[0:26]
	ANS = ''
	mas = [chr(i) for i in range(ord('A'), ord('Z') + 1)]
	ind_mas = 0
	ind_ans = 0
	for ind_ans in ans:
		if ind_ans == '?':
			while mas[ind_mas] in ans:
				ind_mas += 1
			ANS += mas[ind_mas]
			ind_mas += 1
		else:
			ANS += ind_ans
	ind_ANS = 0
	for j in range(n):
		if -1 < j <= 25:
			print(ANS[ind_ANS], end='')
			ind_ANS += 1
		elif s[j] == '?':
			print('A', end='')
		else:
			print(s[j], end='')
	exit()
for i in range(26, n):
	if s[i - 26] == '?':
		k -= 1
	else:
		d[ord(s[i - 26]) - ord('A')] -= 1
	if s[i] == '?':
		k += 1
	else:
		d[ord(s[i]) - ord('A')] += 1
	if sum([bool(i) for i in d]) + k == 26:
		ans = s[i - 25:i + 1]
		ANS = ''
		mas = [chr(ind) for ind in range(ord('A'), ord('Z') + 1)]
		ind_mas = 0
		ind_ans = 0
		for ind_ans in ans:
			if ind_ans == '?':
				while mas[ind_mas] in ans:
					ind_mas += 1
				ANS += mas[ind_mas]
				ind_mas += 1
			else:
				ANS += ind_ans
		ind_ANS = 0
		for j in range(n):
			if i - 26 < j <= i:
				print(ANS[ind_ANS], end='')
				ind_ANS += 1
			elif s[j] == '?':
				print('A', end='')
			else:
				print(s[j], end='')
		break
else:
	print(-1)


s = list(input().strip())
counter = {}
for c in 'abcdefghijklmnopqrstuvwxyz'.upper():
	counter[c] = 0

def get_unused(used):
	for c in 'abcdefghijklmnopqrstuvwxyz'.upper():
		if not c in used:
			return c
	return '?'

def make_string(string, i):
	ind = i
	used = {}
	for c in string[i:i + 26]:
		if c != '?':
			used[c] = True
	while ind < i + 26:
		c = string[ind]
		if c == '?':
			new = get_unused(used)
			string[ind] = new
			used[new] = True
		ind += 1
i = 0
diff = 0
found = False
if len(s) < 26:
	print(-1)
else:
	while i < 26:
		if s[i] != '?':
			counter[s[i]] += 1
			if counter[s[i]] == 1:
				diff += 1
		else:
			diff += 1
		i += 1
	if diff == 26:
		found = True
		make_string(s, i - 26)
	while i < len(s) and (not found):
		if diff == 26:
			make_string(s, i - 26)
			found = True
			break
		if s[i - 26] != '?':
			counter[s[i - 26]] -= 1
			if counter[s[i - 26]] == 0:
				diff -= 1
		if s[i - 26] == '?':
			s[i - 26] = 'A'
			diff -= 1
		if s[i] != '?':
			counter[s[i]] += 1
			if counter[s[i]] == 1:
				diff += 1
		else:
			diff += 1
		i += 1
	if diff != 26:
		print(-1)
	if diff == 26:
		make_string(s, i - 26)
		found = True
	if found:
		while i < len(s):
			if s[i] == '?':
				s[i] = 'A'
			i += 1
		print(''.join(s))


def ACadena(L):
	c = ''
	for k in range(len(L)):
		c += str(L[k])
	return c

def LetrasFaltantes(L):
	A = ['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']
	B = []
	j = 0
	for k in range(26):
		if L[k] == 0:
			B.append(A[k])
			j += 1
	return B

def AgregarLetras(Bool, L, n):
	Letras = LetrasFaltantes(Bool)
	Full = []
	i = 0
	for k in range(n, n + 26):
		if L[k] != '?':
			Full.append(str(L[k]))
		else:
			Full.append(Letras[i])
			i += 1
	return Full
A = ['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']
L = str(input())
Si = 0
R = []
principito = 0
for i in range(len(L) - 25):
	Bool = [0] * 26
	j = 0
	inter = 0
	principito = i
	iiii = 0
	for k in range(i, i + 26):
		if L[k] != '?':
			pos = A.index(L[k])
			if Bool[pos] == 0:
				iiii += 1
				Bool[pos] = 1
			else:
				break
		else:
			inter += 1
		j += 1
	if iiii + inter == 26:
		R = AgregarLetras(Bool, L, principito)
		Si = 1
		break
if Si == 1:
	c = [''] * len(L)
	i = 0
	for k in range(0, principito):
		if str(L[k]) == '?':
			c[i] = 'A'
		else:
			c[i] = str(L[k])
		i += 1
	for k in range(len(R)):
		c[i] = str(R[k])
		i += 1
	for k in range(principito + 26, len(L)):
		if str(L[k]) == '?':
			c[i] = 'A'
		else:
			c[i] = str(L[k])
		i += 1
	c = ACadena(c)
	print(c)
else:
	print('-1')


s = input()
d = {}
o = False
for i in range(len(list(s)) - 25):
	t = list(s[i:i + 26])
	m = 0
	n = False
	d.clear()
	for j in range(26):
		d[j + 65] = 0
	d[63] = 0
	for j in range(i, i + 26):
		d[ord(s[j])] = d[ord(s[j])] + 1
	for j in range(len(d) - 1):
		if d[j + 65] == 0:
			m += 1
			if '?' in t:
				t[t.index('?')] = chr(j + 65)
	if d[63] >= m:
		n = True
	if not n:
		continue
	else:
		for j in range(0, i):
			if s[j] == '?':
				print('A', end='')
			else:
				print(s[j], end='')
		for j in range(len(t)):
			print(t[j], end='')
		for j in range(i + 26, len(s)):
			if s[j] == '?':
				print('A', end='')
			else:
				print(s[j], end='')
		o = True
		break
if not o:
	print(-1)


s = list(input())
n = len(s)
flag = False
ptr = 0
needed = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
for i in range(0, n - 26 + 1):
	sub = s[i:i + 26]
	letters = set()
	ct = 0
	for j in sub:
		if j != '?':
			letters.add(j)
		else:
			ct += 1
	if len(letters) == 26:
		flag = True
		break
	elif len(letters) + ct == 26:
		flag = True
		temp = []
		for let in needed:
			if let not in letters:
				temp.append(let)
		ptr = 0
		for j in range(i, i + 26):
			if s[j] == '?':
				s[j] = temp[ptr]
				ptr += 1
		break
if flag:
	for i in range(n):
		if s[i] == '?':
			s[i] = 'A'
		print(s[i], end='')
else:
	print('-1')


w = set('QWERTYUIOPASDFGHJKLZXCVBNM')
s = list(input())
for i in range(len(s)):
	t = s[i:i + 26]
	a = set(t) | {'?'}
	if len(a) + t.count('?') == 27:
		b = list(w - a)
		for j in range(26):
			if s[i + j] == '?':
				s[i + j] = b.pop()
		print(''.join(s).replace('?', 'A'))
		exit(0)
print(-1)


s = input()

def find(s):
	chars = set()
	ss = ''
	set_s = set(s)
	set_s.discard('?')
	alphabet = {'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 i in s:
		if i == '?':
			new = set(alphabet - set_s)
			letter = new.pop()
			set_s.add(letter)
			chars.add(letter)
			ss += letter
		elif i not in chars:
			chars.add(i)
			ss += i
		elif i in chars:
			return
		if len(ss) == 26:
			return ss
for i in range(len(s)):
	if i + 26 <= len(s):
		ans = find(s[i:i + 26])
		if ans is not None:
			for j in range(len(s)):
				if s[j] == '?':
					s = s[:j] + 'A' + s[j + 1:]
			print(s[:i] + ans + s[i + 26:])
			break
	else:
		print(-1)
		break


def main():
	(s, cnt) = (input(), dict.fromkeys('ABCDEFGHIJKLMNOPQRSTUVWXYZ?', -1))
	for c in s[:25]:
		cnt[c] += 1
	cnt['?'] = -27
	twins = sum((i > 0 for i in cnt.values()))
	for (i, u, v) in zip(range(50000), s, s[25:]):
		cnt[v] = c = cnt[v] + 1
		if c == 1:
			twins += 1
		elif not twins:
			del cnt['?']
			res = [s[:i].replace('?', 'A')]
			for c in filter(cnt.get, cnt):
				while s[i] != '?':
					res.append(s[i])
					i += 1
				res.append(c)
				i += 1
			res.append(s[i:].replace('?', 'A'))
			return print(*res, sep='')
		cnt[u] = c = cnt[u] - 1
		if not c:
			twins -= 1
	print(-1)
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import ceil, floor
abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s = list(input())
if len(s) < 26:
	print(-1)
else:
	val = 0
	for i in range(len(s) - 25):
		d = defaultdict(int)
		for j in range(26):
			d[s[i + j]] += 1
		flag = 0
		for z in abc:
			if d[z] > 1:
				flag = 1
				break
		if flag == 0:
			d = defaultdict(int)
			for y in s[i:i + 26]:
				d[y] += 1
			pos = i
			while pos < i + 26:
				if s[pos] == '?':
					for x in abc:
						if d[x] == 0:
							d[x] = 1
							s[pos] = x
							break
				pos += 1
			val = 1
			break
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'A'
	if val == 0:
		print(-1)
	else:
		print(''.join(s))


def check(s):
	alp = ['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']
	alp1 = ['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']
	c = [0 for i in range(26)]
	for i in range(26):
		if s[i] != '?':
			c[alp.index(s[i])] += 1
			if int(c[alp.index(s[i])]) > 1:
				return ''
			elif s[i] in alp1:
				alp1.remove(s[i])
	ans = ''
	uk = 0
	for i in range(26):
		if s[i] == '?':
			ans += alp1[uk]
			uk += 1
		else:
			ans += s[i]
	return ans
s = input()
n = len(s)
if n < 26:
	print(-1)
	exit()
fl = False
tmp = ''
for i in range(n - 25):
	tmp = check(s[i:i + 26])
	if tmp != '':
		for j in range(n):
			if j < i or j >= i + 26:
				if s[j] == '?':
					print('A', end='')
				else:
					print(s[j], end='')
			else:
				print(tmp[j - i], end='')
		exit()
		fl = True
if not fl:
	print(-1)


s = input()
r = [ord(c) - 65 for c in s]
solv = False
for i in range(len(r) - 25):
	t = r[i:i + 26]
	arr = []
	for k in range(26):
		if t.count(k) == 0:
			arr += [k]
		if t.count(k) > 1:
			break
	else:
		if not solv:
			solv = True
			for j in range(i):
				print(s[j] if s[j] != '?' else 'A', end='')
			c = 0
			for j in range(i, i + 26):
				if s[j] != '?':
					print(s[j], end='')
				else:
					print(chr(arr[c] + 65), end='')
					c += 1
			for j in range(i + 26, len(r)):
				print(s[j] if s[j] != '?' else 'A', end='')
if not solv:
	print(-1)


s = input()
b = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'Z', 'T', 'U', 'V', 'W', 'X', 'Y', 'S']
a = set(b)
cnt = 0
ans = ''
an = False
ind = -1
anss = set()
for j in range(len(s) - 25):
	c = set()
	cnt = 0
	for i in range(j, j + 26):
		if s[i] != '?':
			c.add(s[i])
		else:
			cnt += 1
	if len(c) + cnt == 26:
		an = True
		ind = j
		anss = c
if an:
	for i in range(ind):
		if s[i] == '?':
			ans += 'A'
		else:
			ans += s[i]
	conr = set()
	for i in range(ind, ind + 26):
		if s[i] != '?':
			conr.add(s[i])
	df = sorted(list(a - conr))
	index = 0
	for i in range(ind, ind + 26):
		if s[i] == '?':
			ans += df[index]
			index += 1
		else:
			ans += s[i]
	for i in range(ind + 26, len(s)):
		if s[i] == '?':
			ans += 'A'
		else:
			ans += s[i]
	print(ans)
else:
	print(-1)


s = input()
v = [i for i in s]
t = [0 for i in range(26)]
f = 0
q = 0
for i in range(len(v)):
	if v[i] == '?':
		q = q + 1
	else:
		t[ord(v[i]) - 65] += 1
	if i > 24:
		c = t.count(0)
		if c == q:
			d = []
			for k in range(26):
				if t[k] == 0:
					d.append(chr(k + 65))
			l = 0
			for k in range(0, i - 25):
				if v[k] == '?':
					print('A', end='')
				else:
					print(v[k], end='')
			for k in range(i - 25, i + 1):
				if v[k] == '?':
					print(d[l], end='')
					l = l + 1
				else:
					print(v[k], end='')
			for k in range(i + 1, len(v)):
				if v[k] == '?':
					print('A', end='')
				else:
					print(v[k], end='')
			f = 1
			break
		elif v[i - 25] == '?':
			q = q - 1
		else:
			t[ord(v[i - 25]) - 65] -= 1
if f == 0:
	print('-1')


import collections
a = input()
ans = []
flag = 100
for j in range(0, len(a)):
	if j + 25 >= len(a):
		break
	c = a[j:j + 26]
	flag = 0
	ans = []
	d = collections.Counter(c)
	for i in range(0, 26):
		b = chr(i + 65)
		if d[b] == 0:
			if d['?'] != 0:
				ans.append(b)
				d['?'] -= 1
			else:
				flag = 100
				break
	if flag == 0:
		flag = j
		break
if flag == 100:
	print('-1')
else:
	a = list(a)
	j = 0
	for i in range(0, len(a)):
		if a[i] == '?' and j < len(ans) and (i >= flag):
			a[i] = ans[j]
			j += 1
		elif a[i] == '?':
			a[i] = 'A'
	print(*a, sep='')


import string
L = 26

def nice_substr(s):
	q = s.count('?')
	x = set(filter(lambda c: c.isupper(), s))
	a = len(x)
	if a + q != L:
		return (False, '')
	rest = set(string.ascii_uppercase) - x
	ans = list(s)
	for i in range(L):
		if ans[i] == '?':
			ans[i] = rest.pop()
	return (True, ''.join(ans))

def compute(s):
	n = len(s)
	if n < L:
		return '-1'
	for i in range(n - L + 1):
		(j, t) = nice_substr(s[i:i + L])
		if j:
			return s[:i].replace('?', 'A') + t + s[i + L:].replace('?', 'A')
	else:
		return '-1'

def main():
	print(compute(input()))
main()


st = input()
if len(st) < 26:
	print(-1)
else:
	start = 0
	last = 25
	d = {}
	questions = 0
	for i in range(26):
		check = st[i]
		if check == '?':
			questions += 1
		else:
			d[check] = d.get(check, 0) + 1
	found = False
	while last < len(st) and (not found):
		if len(d) + questions == 26:
			found = True
		else:
			startch = st[start]
			if startch == '?':
				questions -= 1
			else:
				d[startch] = d[startch] - 1
				if d[startch] == 0:
					d.pop(startch)
			start += 1
			last += 1
			if last < len(st):
				lastch = st[last]
				if lastch == '?':
					questions += 1
				else:
					d[lastch] = d.get(lastch, 0) + 1
	if not found:
		print(-1)
	else:
		letters = []
		ch = 'A'
		for i in range(26):
			letters.append(ch)
			ch = chr(ord(ch) + 1)
		for i in range(start, last + 1):
			if st[i] != '?':
				letters.remove(st[i])
		newst = ''
		for i in range(start, last + 1):
			if st[i] != '?':
				newst += st[i]
			else:
				newst += letters.pop(0)
		begin = st[0:start].replace('?', 'A')
		end = st[last + 1:].replace('?', 'Z')
		answer = begin + newst + end
		print(answer)


s = list(input())
if len(s) < 26:
	print(-1)
else:
	(a, b) = (0, 0)
	for i in range(len(s) - 26 + 1):
		j = i + 1
		temp = [s[i]]
		w = 0
		flag = 0
		while j < len(s):
			if s[j] == '?':
				w += 1
			elif s[j] in temp:
				break
			else:
				temp.append(s[j])
			if len(temp) + w == 26:
				(a, b) = (i, j)
				flag = 1
				break
			j += 1
		if flag == 1:
			break
	if flag == 0:
		print(-1)
	elif flag == 1:
		letter = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
		for i in range(a):
			if s[i] == '?':
				s[i] = 'A'
		for i in range(b + 1, len(s)):
			if s[i] == '?':
				s[i] = 'A'
		for i in range(a, b + 1):
			if s[i] in letter:
				letter.remove(s[i])
		j = 0
		for i in range(a, b + 1):
			if s[i] == '?':
				s[i] = letter[j]
				j += 1
		print(''.join(s))


s = input()
if len(s) < 26:
	print(-1)
	exit()
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
c = [0] * 26
d = {}
for i in range(26):
	d[i] = alph[i]

def check(pos):
	if pos + 26 > len(s):
		return 0
	SET = set()
	for i in range(pos, pos + 26):
		if s[i] in SET and s[i] != '?':
			return 0
		SET.add(s[i])
	return 1
pos = -1
for i in range(len(s)):
	if check(i):
		pos = i
if pos == -1:
	print(-1)
	exit()
s = list(s)
SET = set()
for i in range(pos, pos + 26):
	SET.add(s[i])

def findnext():
	for i in alph:
		if i not in SET:
			SET.add(i)
			return i
for i in range(pos, pos + 26):
	if s[i] == '?':
		s[i] = findnext()
for i in range(len(s)):
	if s[i] == '?':
		s[i] = 'A'
print(''.join(s))


def make_id(x):
	if 'A' <= x and x <= 'Z':
		return ord(x) - ord('A')
	return 26

def find(x):
	for i in range(26):
		if x[i] == 0:
			x[i] = 1
			return chr(i + ord('A'))
s = list(input())
n = len(s)
if n < 26:
	print('-1')
	exit(0)
h = [0] * 27
for i in range(n):
	h[make_id(s[i])] += 1
	if i >= 26:
		h[make_id(s[i - 26])] -= 1
	if i >= 25:
		p = 0
		for j in range(26):
			if h[j] == 1:
				p += 1
		q = h[26]
		if p + q == 26:
			for j in range(26):
				if s[i - j] == '?':
					s[i - j] = find(h)
			for j in range(n):
				if s[j] == '?':
					s[j] = 'A'
			print(''.join(map(str, s)))
			exit(0)
print('-1')


et = 'ABCDEFGHIJKLMNOPQRSTUXYZVW'
s = input()
n = len(s)
n1 = 0
l = []
if n >= 26:
	f = 1
	for i in range(n - 25):
		tmp = {}
		f = 1
		for j in range(26):
			if s[i + j] != '?' and s[i + j] in tmp:
				f = 0
				break
			else:
				tmp[s[i + j]] = 1
		if f:
			l = [i for i in et if not i in tmp]
			n1 = i
			break
	if f:
		for (i, e) in enumerate(s):
			if e == '?':
				if i < n1:
					print('A', end='')
				elif i - n1 < 26:
					print(l.pop(), end='')
				else:
					print('A', end='')
			else:
				print(e, end='')
	else:
		print('-1')
else:
	print('-1')


s = input()
n = len(s)
c1 = 0
for i in range(n - 25):
	s1 = s[i:i + 26]
	s2 = set()
	c = 0
	for j in s1:
		if j == '?':
			c += 1
		else:
			s2.add(j)
	if len(s2) + c == 26:
		c1 = 1
		k = i
		break
if c1 == 0:
	print(-1)
else:
	l = [0] * 26
	for i in s1:
		if i != '?':
			l[ord(i) - ord('A')] += 1
	s3 = ''
	for i in range(26):
		if l[i] == 0:
			s3 += chr(ord('A') + i)
	s4 = ''
	for j in range(k):
		if s[j] == '?':
			s4 += 'A'
		else:
			s4 += s[j]
	j = 0
	for i in s1:
		if i == '?':
			s4 += s3[j]
			j += 1
		else:
			s4 += i
	for i in range(k + 26, n):
		if s[i] == '?':
			s4 += 'A'
		else:
			s4 += s[i]
	print(s4)


a = list(map(str, input()))
main = set(map(str, 'ABCDEFGHIJKLMNOPQRZTUVWXYS'))
cur = main.copy()
if len(a) < 26:
	print(-1)
	exit()
for i in range(len(a) - 25):
	mb = True
	for c in range(26):
		if a[i + c] != '?':
			if not cur.__contains__(a[i + c]):
				mb = False
				break
			cur.remove(a[i + c])
	if mb:
		ans = ''
		for c in range(i):
			if a[c] == '?':
				ans += 'A'
			else:
				ans += a[c]
		for c in range(26):
			if a[i + c] != '?':
				ans += a[i + c]
			else:
				ans += cur.pop()
		for c in range(i + 26, len(a)):
			if a[c] == '?':
				ans += 'A'
			else:
				ans += a[c]
		print(ans)
		exit()
	cur = main.copy()
print(-1)


s = input()
a = {'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'}
ans = 0
if len(s) < 26:
	print(-1)
else:
	ind = 0
	for i in range(len(s) - 26 + 1):
		k = s[i:26 + i]
		b = set(k)
		if k.count('?') == 0 and len(b) == 26:
			a = a - b
			ans = 1
			ind = i
			break
		elif len(b) - 1 + k.count('?') == 26:
			a = a - b
			ans = 1
			ind = i
			break
	if ans == 0:
		print(-1)
	else:
		b = list(a)
		k = ''
		for i in range(ind):
			if s[i] == '?':
				k = k + 'A'
			else:
				k = k + s[i]
		for i in range(ind, ind + 26):
			if s[i] == '?':
				k = k + b[0]
				b.remove(b[0])
			else:
				k = k + s[i]
		for i in range(ind + 26, len(s)):
			if s[i] == '?':
				k = k + 'A'
			else:
				k = k + s[i]
		print(k)


from collections import Counter
s = input()
if len(s) < 26:
	print(-1)
else:
	a = Counter(s[:26])
	score = len(a)
	if '?' in a:
		score += a['?'] - 1
	ans = []
	if score == 26:
		for c in s[:26]:
			if c == '?':
				for z in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
					if not a[z]:
						a[z] = 1
						ans += z
						break
			else:
				ans += c
		for c in s[26:]:
			ans += 'A' if c == '?' else c
		print(''.join(ans))
	else:
		for (i, c) in enumerate(s[26:]):
			p = s[i]
			ans += 'A' if p == '?' else p
			a[p] -= 1
			if p == '?' or a[p] == 0:
				score -= 1
			a[c] += 1
			if c == '?' or a[c] == 1:
				score += 1
			if score == 26:
				for c in s[i + 1:i + 27]:
					if c == '?':
						for z in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
							if not a[z]:
								a[z] = 1
								ans += z
								break
					else:
						ans += c
				for c in s[i + 27:]:
					ans += 'A' if c == '?' else c
				print(''.join(ans))
				break
		else:
			print(-1)


st = list(input())

def printer(start, end):
	done = {}
	for al in range(ord('A'), ord('Z') + 1):
		done[al] = 0
	for c in st[start:end + 1]:
		done[ord(c)] = 1
	for c in st[0:start]:
		if c == '?':
			print('A', end='')
		else:
			print(c, end='')
	for c in st[start:end + 1]:
		if c != '?':
			print(c, end='')
		else:
			for al in range(ord('A'), ord('Z') + 1):
				if not done[al]:
					print(chr(al), end='')
					done[al] = 1
					break
	for c in st[end + 1:]:
		if c == '?':
			print('A', end='')
		else:
			print(c, end='')
	print()
cnt = {}
for al in range(ord('A'), ord('Z') + 1):
	cnt[al] = 0
start = 0
mis = 0
have = 0
did = 0
if len(st) < 26:
	print('-1')
	raise SystemExit
for (i, c) in enumerate(st):
	if c == '?':
		mis += 1
	else:
		while start < i and cnt[ord(c)] != 0:
			if st[start] == '?':
				mis -= 1
			else:
				cnt[ord(st[start])] = 0
				have -= 1
			start += 1
		cnt[ord(c)] = 1
		have += 1
	if have + mis == 26:
		did = 1
		printer(start, i)
		break
if not did:
	print('-1')


s = list(input())
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
(L, R) = (0, 0)
st = set()
ans = -1
while R < len(s):
	while R < len(s) and s[R] not in st and (R - L < 26):
		if s[R] != '?':
			st.add(s[R])
		R += 1
	if R - L < 26:
		if R == len(s):
			if R - L < 26:
				break
			R -= 1
		while s[R] in st:
			if s[L] != '?':
				st.remove(s[L])
			L += 1
	else:
		rest = ''.join(set(alph) - st)
		idx = 0
		for k in range(L, R):
			if s[k] == '?':
				s[k] = rest[idx]
				idx += 1
		s = ''.join(s)
		ans = s.replace('?', 'A')
		break
print(ans)


h = input()
s = []
for i in range(len(h)):
	s.append(h[i])
if len(s) < 26:
	print(-1)
else:
	a = [0] * 26
	q = []
	ques = 0
	for i in range(26):
		if s[i] == '?':
			ques += 1
			q.append(i)
		else:
			a[ord(s[i]) - 65] += 1
	x = 0
	y = 26
	flag = 0
	for i in range(len(s) - 26):
		if max(a) <= 1:
			if 26 - sum(a) == ques:
				flag = 1
				break
		if s[x] == '?':
			ques -= 1
			q.pop(0)
		else:
			a[ord(s[x]) - 65] -= 1
		if s[y] == '?':
			ques += 1
			q.append(y)
		else:
			a[ord(s[y]) - 65] += 1
		x += 1
		y += 1
	if max(a) <= 1:
		if 26 - sum(a) == ques:
			flag = 1
	if flag == 0:
		print(-1)
	else:
		j = 0
		for i in range(26):
			if a[i] == 0:
				s[q[j]] = chr(i + 65)
				j += 1
		for i in range(len(s)):
			if s[i] == '?':
				s[i] = 'A'
		for i in range(len(s)):
			print(s[i], end='')


import sys
s = input()
s = list(s)
if len(s) < 26:
	print(-1)
else:
	ans = ''
	c = 0
	a = 0
	mm = ['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 i in range(0, len(s) - 25):
		flag = 1
		m = {}
		m = {k: 0 for k in mm}
		for j in range(i, i + 26):
			if s[j] != '?':
				m[s[j]] += 1
				if m[s[j]] > 1:
					flag = 0
					break
		if flag == 1:
			for k in range(i, i + 26):
				if s[k] == '?':
					for j in mm:
						if m[j] == 0:
							s[k] = j
							m[j] += 1
							break
			for i in range(0, len(s)):
				if s[i] == '?':
					s[i] = 'A'
			print(''.join(s))
			sys.exit()
	print(-1)


s = input()
n = len(s)
i = 0
a = [(0, 0) for x in range(0, 26)]
l = 0
b = 0
while i < n:
	if s[i] == '?':
		i += 1
		l += 1
	else:
		intc = ord(s[i]) - ord('A')
		if a[intc][0] == 0:
			a[intc] = (1, i)
			l += 1
			i += 1
		else:
			i = a[intc][1] + 1
			l = 0
			for k in range(0, 26):
				a[k] = (0, 0)
	if l == 26:
		b = 1
		i -= 26
		break
p = list(s)
if b == 0:
	print(-1)
else:
	for j in range(i, i + 26):
		if p[j] == '?':
			for k in range(0, 26):
				if a[k][0] == 0:
					a[k] = (1, 0)
					p[j] = chr(k + ord('A'))
					break
	for j in range(0, n):
		if p[j] == '?':
			p[j] = 'A'
	w = ''.join(p)
	print(w)


s = input()
alpa = ['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']
if len(s) < 26:
	print(-1)
else:
	arr = []
	for i in s:
		arr.append(i)
	flag = False
	for i in range(len(arr) - 25):
		ar = arr[i:i + 26]
		c = ar.count('?')
		if c != 0:
			if len(set(ar)) + (c - 1) == 26:
				flag = True
				for j in range(len(ar)):
					if ar[j] == '?':
						for k in alpa:
							if k not in ar:
								ar[j] = k
				break
		elif len(set(ar)) == 26:
			flag = True
			break
	if not flag:
		print(-1)
	else:
		new_arr = arr[:i] + ar[:] + arr[i + 26:]
		for l in range(len(new_arr)):
			if new_arr[l] == '?':
				new_arr[l] = 'A'
		for i in new_arr:
			print(i, end='')


S = list(input())
T = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
flag = False
for i in range(len(S) - 25):
	tmp = [0] * 26
	for j in range(26):
		if S[i + j] in T:
			tmp[T.index(S[i + j])] += 1
	if max(tmp) <= 1:
		k = 0
		for j in range(26):
			if S[i + j] == '?':
				while k < 26 and tmp[k] == 1:
					k += 1
				S[i + j] = T[k]
				tmp[k] = 1
		flag = True
		break
if flag:
	for i in range(len(S)):
		if S[i] == '?':
			S[i] = 'A'
	print(''.join(S))
else:
	print(-1)


from collections import Counter
import string

def can_complete(s):
	if len(s) < 26:
		return (False, -1)
	count = Counter()
	for x in string.ascii_uppercase:
		count[x] = 0
	can = 0
	first = s[0]
	(i, j) = (0, 26)
	for k in range(i, j):
		if s[k] != '?':
			count[s[k]] += 1
			if count[s[k]] == 1:
				can += 1
		else:
			can += 1
	if can == 26:
		return (count, i)
	i += 1
	while j < len(s):
		if first != '?':
			count[first] -= 1
			if count[first] == 0:
				can -= 1
		else:
			can -= 1
		if s[j] != '?':
			count[s[j]] += 1
			if count[s[j]] == 1:
				can += 1
		else:
			can += 1
		if can == 26:
			return (count, i)
		first = s[i]
		i += 1
		j += 1
	return (False, -1)
s = input()
(res, i) = can_complete(s)
if not res:
	print(-1)
else:
	can_use = [k for k in res if res[k] == 0]
	q = 0
	for h in range(len(s)):
		x = s[h]
		if x == '?':
			if i <= h < i + 26:
				x = can_use[q]
				q += 1
			else:
				x = 'A'
		print(x, end='')
	print()


from sys import stdin, stdout
a = list(input())
l = len(a)
if l < 26:
	stdout.write('-1')
	exit()
z = [0] * 26
gh = []

def check(k):
	global a
	s = 0
	if max(z) < 2:
		for i in range(26):
			if a[i + k] == '?':
				while z[s] != 0 and s < 26:
					s += 1
				a[i + k] = chr(65 + s)
				s += 1
		a = ''.join(a).replace('?', 'K')
		stdout.write(a)
		exit()
for i in range(26):
	if a[i] != '?':
		z[ord(a[i]) - 65] += 1
check(0)
for i in range(26, l):
	if a[i - 26] != '?':
		z[ord(a[i - 26]) - 65] -= 1
	if a[i] != '?':
		z[ord(a[i]) - 65] += 1
	check(i - 25)
print(-1)


import string
s = str(input())
kq = ''
for i in range(max(1, len(s) - 26 + 1)):
	tam = set()
	dem = 0
	sub_s = list(s[i:i + 26])
	for pt in range(len(sub_s)):
		if sub_s[pt] == '?':
			dem += 1
		else:
			tam.add(sub_s[pt])
	if dem + len(tam) == 26:
		for j in range(len(sub_s)):
			if sub_s[j] == '?':
				for pt in list(string.ascii_uppercase):
					if pt not in tam:
						sub_s[j] = pt
						tam.add(pt)
						break
		kq = s[:i].replace('?', 'A') + ''.join(map(str, sub_s)) + s[i + 26:].replace('?', 'A')
		break
if kq != '':
	print(kq)
else:
	print(-1)


from sys import stdin, stdout
from math import gcd, sqrt, factorial
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7

def fill(v):
	p = [1] * 26
	for i in v:
		if i >= 0:
			p[i] = 0
	p = [i for i in range(26) if p[i]]
	for i in range(26):
		if v[i] < 0:
			v[i] = p.pop()
	return v
s = list(map(lambda x: ord(x) - 65, S()))
ln = len(s)
a = [0] * 26
if ln < 26:
	print(-1)
	exit()
cnt = 0
for i in s[:26]:
	if i >= 0:
		a[i] += 1
		if a[i] == 2:
			cnt += 1
flg = False
for i in range(ln - 26 + 1):
	if i:
		m = s[i - 1]
		if m >= 0:
			if a[m] == 2:
				cnt -= 1
			a[m] -= 1
		m = s[i + 25]
		if m >= 0:
			if a[m] == 1:
				cnt += 1
			a[m] += 1
	if not cnt:
		flg = True
		s = s[:i] + fill(s[i:i + 26]) + s[26 + i:]
		for i in range(ln):
			if s[i] < 0:
				s[i] = 25
		break
if flg:
	print(*[chr(i + 65) for i in s], sep='')
else:
	print(-1)


def fill_remaining(s, counts, count_q):
	assert len(s) == 26
	letters = []
	for (idx, count) in enumerate(counts):
		if count == 0:
			letters.append(chr(ord('A') + idx))
		else:
			assert count == 1
	assert len(letters) == count_q
	res = ''
	for ch in s:
		if ch == '?':
			res += letters.pop()
		else:
			res += ch
	return res

def fill_any(s):
	return s.replace('?', 'A')

def solve(s):
	if len(s) < 26:
		return -1
	counts = [0] * 26
	count_q = 0
	count_zeros = 26
	for (i, ch) in enumerate(s):
		if i >= 26:
			if s[i - 26] == '?':
				count_q -= 1
			else:
				idx = ord(s[i - 26]) - ord('A')
				assert counts[idx] >= 0
				counts[idx] -= 1
				if counts[idx] == 0:
					count_zeros += 1
		if ch == '?':
			count_q += 1
		else:
			idx = ord(ch) - ord('A')
			if counts[idx] == 0:
				count_zeros -= 1
			counts[idx] += 1
		if i >= 25 and count_zeros == count_q:
			return fill_any(s[:i - 26 + 1]) + fill_remaining(s[i - 26 + 1:i + 1], counts, count_q) + fill_any(s[i + 1:])
	return -1
s = input()
print(solve(s))


import collections
s = input()
n = len(s)
if n < 26:
	print(-1)
	exit()
d = [0] * 26
for i in range(25):
	if s[i] != '?':
		d[ord(s[i]) - ord('A')] += 1

def check():
	return all((d[i] <= 1 for i in range(26)))
b = False
for i in range(25, n):
	if s[i] != '?':
		d[ord(s[i]) - ord('A')] += 1
	if i >= 26:
		if s[i - 26] != '?':
			d[ord(s[i - 26]) - ord('A')] -= 1
	if check():
		for j in range(n):
			if s[j] != '?':
				print(s[j], end='')
			elif j < i - 25 or j > i:
				print('A', end='')
			else:
				for k in range(26):
					if d[k] == 0:
						print(chr(ord('A') + k), end='')
						d[k] = 1
						break
		exit()
print(-1)


s = input()
l1 = []
l2 = []
i = 0
ss = 0
if len(s) < 26:
	print(-1)
else:
	while True:
		p = 0
		for item in s[i:i + 26]:
			if ord(item) not in l1:
				l1.append(ord(item))
		for j in range(65, 91):
			if j not in l1:
				l2.append(j)
				p += 1
		if s[i:i + 26].count('?') != p:
			if i + 26 == len(s):
				print(-1)
				break
			else:
				i += 1
				l1.clear()
				l2.clear()
				continue
		else:
			k = 0
			if i > 0:
				print(s[:i].replace('?', 'A'), end='')
			ss = s[i:i + 26].split('?')
			for item in ss:
				print(item, end='')
				print(chr(l2[k]), end='') if k < len(l2) else print('', end='')
				k += 1
			if i + 26 < len(s):
				print(s[i + 26:].replace('?', 'A'), end='')
			break


import os
S = input()
ans = 0
for i in range(0, len(S) - 25):
	x = [0] * 26
	free = 0
	length = 0
	for j in range(0, 26):
		if S[i + j] == '?':
			free += 1
		elif x[ord(S[i + j]) - ord('A')] == 1:
			break
		else:
			x[ord(S[i + j]) - ord('A')] = 1
			length += 1
	if free + length == 26:
		for j in range(i, i + 26):
			if S[j] == '?':
				for k in range(0, 26):
					if x[k] == 0:
						x[k] = 1
						S = S[:j] + chr(k + ord('A')) + S[j + 1:]
						break
		ans = 1
		break
if ans == 1:
	for i in range(0, len(S)):
		if S[i] == '?':
			print('A', end='')
		else:
			print(S[i], end='')
	print()
else:
	print(-1)


s = input()
n = len(s)
if n < 26:
	print(-1)
else:
	t1 = []
	i = 0
	flag = 0
	while i <= n - 26:
		for j in range(i, i + 26):
			if s[j] not in t1 or s[j] == '?':
				t1 += [s[j]]
		if len(t1) == 26:
			flag = 1
			x1 = i
			x2 = i + 26
			break
		else:
			t1 = []
		i += 1
	if flag == 0:
		print(-1)
	else:
		t2 = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
		for i in range(26):
			for j in range(26):
				if t1[i] == '?' and t2[j] not in t1:
					t1[i] = t2[j]
		i = 0
		t3 = list(s)
		while i < n:
			if i == x1:
				j = 0
				while j < 26:
					t3[j + x1] = t1[j]
					j += 1
			i += 1
		t4 = ''
		for i in range(n):
			if t3[i] == '?':
				t4 += 'A'
			else:
				t4 += t3[i]
		print(t4)


import sys
from math import *
from string import ascii_uppercase

def ints_input():
	return [int(i) for i in sys.stdin.readline().strip('\n').split(' ')]

def print_list(arr):
	sys.stdout.writelines((str(x) + ' ' for x in arr))
	sys.stdout.write('\n')

def fast_input(type=str):
	return type(sys.stdin.readline().strip('\n'))
s = fast_input()
if len(s) < 26:
	print(-1)
	exit()
(r, j) = (0, 25)
found = False
while not found and j < len(s):
	sl = s[r:j + 1]
	q = sl.count('?')
	if len(set(sl)) + q - 1 == 26 or len(set(sl)) == 26:
		found = True
	else:
		r += 1
		j += 1
if not found:
	print(-1)
	exit()
d = {}
for i in ascii_uppercase + '?':
	d[i] = 0
for i in sl:
	d[i] += 1
d.pop('?')
zz = list(filter(lambda x: not x[1], d.items()))
k = 0
s = list(s)
for i in range(len(s)):
	if s[i] == '?':
		if r <= i <= j:
			s[i] = zz[k][0]
			k += 1
		else:
			s[i] = 'A'
print(''.join(s))


def main():
	A = list(input())
	gd = 0
	for i in range(25, len(A)):
		cnt = [0] * 26
		for j in range(26):
			if A[i - j] != '?':
				cnt[ord(A[i - j]) - ord('A')] += 1
		ck = 1
		for j in range(26):
			if cnt[j] > 1:
				ck = 0
		if ck == 1:
			Nd = []
			for j in range(26):
				if cnt[j] == 0:
					Nd.append(j)
			for j in range(26):
				if A[i - j] == '?':
					A[i - j] = chr(Nd.pop() + ord('A'))
			gd = 1
			break
	for i in range(len(A)):
		if A[i] == '?':
			A[i] = 'A'
	if gd == 1:
		for x in A:
			print(x, end='')
	else:
		print(-1)
	return 0
main()


z = input()
if len(z) < 26:
	print(-1)
	exit()
ans = []
for i in range(len(z) - 26 + 1):
	x = z[i:i + 26]
	temp = []
	for i in range(len(x)):
		temp.append(x[i])
	ans.append(temp)
flag = 0
for i in range(len(ans)):
	x = ans[i]
	count = 0
	temp = [0 for t in range(26)]
	for j in range(len(x)):
		if x[j] == '?':
			count += 1
			continue
		if temp[ord(x[j]) - 65] == 0:
			temp[ord(x[j]) - 65] = 1
			count += 1
	if count >= 26:
		flag = 1
		kam = []
		for m in range(len(temp)):
			if temp[m] == 0:
				kam.append(m)
		l = 0
		for u in range(len(x)):
			if x[u] == '?':
				if l < len(kam):
					x[u] = chr(kam[l] + 65)
				else:
					x[u] = 'A'
				l += 1
		tin = ''.join(map(str, x))
		fin = z[0:i] + tin + z[i + 26:]
		kam = []
		for i in range(len(fin)):
			kam.append(fin[i])
		for i in range(len(kam)):
			if kam[i] == '?':
				kam[i] = 'A'
		print(''.join(map(str, kam)))
		break
if flag == 0:
	print(-1)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
s = input()
s = list(s)
n = len(s)
if n < 26:
	print(-1)
	exit()
ch = 0
for i in range(n - 25):
	st = set(s[i:i + 26])
	if '?' in st:
		st.remove('?')
	if len(st) + s[i:i + 26].count('?') == 26:
		ch = 1
		if s[i:i + 26].count('?') == 0:
			break
		k = 65
		for j in range(i, i + 26):
			if s[j] == '?':
				while True:
					if chr(k) not in s[i:i + 26]:
						s[j] = chr(k)
						k += 1
						break
					else:
						k += 1
for i in range(n):
	if s[i] == '?':
		s[i] = 'A'
if ch == 0:
	print(-1)
else:
	print(*s, sep='')


import os
from math import *
import copy
from bisect import *
s = input()
if len(s) < 26:
	print('-1')
else:
	z = 0
	xx = ['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 i in range(len(s) - 25):
		ns = s[i:i + 26]
		ns = sorted(ns)
		x = []
		sign = 0
		for j in range(len(ns)):
			if ns[j] == '?':
				sign += 1
			else:
				x.append(ns[j])
		xxx = list(set(xx).difference(set(x)))
		if len(x) == len(set(x)):
			z = 1
			for j in range(len(s)):
				if j >= i and j < i + 26:
					if s[j] == '?':
						print(xxx[-1], end='')
						xxx.pop()
					else:
						print(s[j], end='')
				elif s[j] == '?':
					print('A', end='')
				else:
					print(s[j], end='')
		if z == 1:
			break
	if z == 0:
		print('-1')


__author__ = 'Think'
word = [ord(i) - 64 for i in input().split()[0]]
letters = [0] * 26
substring = -1
for i in range(len(word)):
	position = i % 26
	letters[position] = -1
	current = word[i]
	if current == -1:
		letters[position] = current
	elif current in letters:
		letters[letters.index(current)] = 0
		letters[position] = current
	if 0 in letters:
		letters[position] = current
	else:
		substring = i - 25
		letters[position] = current
		break
if 0 not in letters and substring == -1:
	substring = len(word) - 26
if substring == -1:
	print(-1)
else:
	substring_letters = [0] * 26
	for i in range(substring, substring + 26):
		position = i % 26
		if letters[position] > 0:
			substring_letters[i - substring] = letters[position]
		elif letters[position] == 0:
			print('ERROR 0 in letters', letters, position, substring)
	for i in range(1, 27):
		if i not in substring_letters:
			substring_letters[substring_letters.index(0)] = i
	if 0 in substring_letters:
		print('ERROR 0 in substring_letters', substring_letters)
	for i in range(len(word)):
		current = word[i]
		if i < substring or i > substring + 25:
			if current == -1:
				print('A', end='')
			else:
				print(chr(current + 64), end='')
		else:
			print(chr(substring_letters[i - substring] + 64), end='')
	print('\n')


from collections import Counter
s = input()
counter = Counter(s[:26])
(left, right) = (0, 0)
if len(counter) - int('?' in counter) + counter['?'] == 26:
	(left, right) = (0, 26)
else:
	for i in range(26, len(s)):
		counter[s[i]] += 1
		counter[s[i - 26]] -= 1
		if counter[s[i - 26]] == 0:
			del counter[s[i - 26]]
		if len(counter) - int('?' in counter) + counter['?'] == 26:
			(left, right) = (i - 25, i + 1)
			break
if right:
	a = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ') - counter.keys()
	ans = ''
	for i in range(len(s)):
		if s[i] == '?':
			if left <= i < right:
				ans += a.pop()
			else:
				ans += 'A'
		else:
			ans += s[i]
	print(ans)
else:
	print('-1')


import sys
st = str(input())
n = len(st)
s = []
d = [0 for i in range(27)]

def check(l, r):
	for i in range(27):
		d[i] = 0
	for i in range(l, r):
		if st[i] != '?':
			d[ord(st[i]) - ord('A') + 1] += 1
			if d[ord(st[i]) - ord('A') + 1] > 1:
				return bool(0)
	return bool(1)
ok = bool(0)
for i in range(n - 25):
	if check(i, i + 26):
		b = []
		cnt = 0
		ok = bool(1)
		for j in range(1, 27):
			if d[j] == 0:
				b.append(chr(j - 1 + ord('A')))
		cnt = -1
		res = ''
		for j in range(len(st)):
			if (st[j] == '?') & (j >= i) & (j <= i + 25):
				cnt += 1
				res += b[cnt]
			elif st[j] == '?':
				res += 'A'
			else:
				res += st[j]
		print(res)
		break
if not ok:
	print(-1)


s = input()
prefix = [[0 for i in range(26)] for j in range(len(s))]
for i in range(len(s)):
	for j in range(26):
		if j == ord(s[i]) - ord('A'):
			if i == 0:
				prefix[i][j] = 1
			else:
				prefix[i][j] = prefix[i - 1][j] + 1
		elif i == 0:
			prefix[i][j] = 0
		else:
			prefix[i][j] = prefix[i - 1][j]
index = -1
for i in range(25, len(s)):
	check = True
	for j in range(26):
		if i == 25:
			if prefix[i][j] > 1:
				check = False
				break
		elif prefix[i][j] - prefix[i - 26][j] > 1:
			check = False
			break
	if check:
		index = i - 25
		break
if index == -1:
	print(-1)
else:
	letters = []
	for j in range(26):
		if index == 0:
			if prefix[index + 25][j] == 1:
				letters.append(j)
		elif prefix[index + 25][j] - prefix[index - 1][j] == 1:
			letters.append(j)
	res = []
	for i in range(len(s)):
		if i < index or i > index + 25:
			if s[i] == '?':
				res.append('T')
			else:
				res.append(s[i])
		elif s[i] == '?':
			for j in range(26):
				if letters.count(j) <= 0:
					res.append(chr(j + ord('A')))
					letters.append(j)
					break
		else:
			res.append(s[i])
	print(''.join(res))


from string import ascii_uppercase as C

def f(s):
	for i in range(len(s)):
		t = s[i:i + 26]
		X = set(t) | {'?'}
		if len(X) + t.count('?') == 27:
			x = list(set(C) - X)
			for j in range(26):
				if s[i + j] == '?':
					s[i + j] = x.pop()
			return ''.join(s).replace('?', 'A')
	return '-1'
print(f(list(input())))


a = list(input())
A = set()
cou = [0] * 26
if len(a) < 26:
	print(-1)
else:
	s = 0
	per = -1
	for j in range(26):
		if a[j] != '?':
			A.add(a[j])
			cou[ord(a[j]) - 65] += 1
		else:
			s += 1
	if len(A) + s == 26:
		per = 0
	for j in range(0, len(a) - 26):
		if a[j] == '?':
			s -= 1
		else:
			cou[ord(a[j]) - 65] -= 1
			if cou[ord(a[j]) - 65] == 0:
				A.discard(a[j])
		if a[j + 26] != '?':
			A.add(a[j + 26])
			cou[ord(a[j + 26]) - 65] += 1
		else:
			s += 1
		if len(A) + s == 26:
			per = j + 1
			break
	if per == -1:
		print(-1)
	else:
		A = set('ABCDEFGHIJKLMNOPQRZTUVWXYS')
		for j in range(per, per + 26):
			if a[j] != '?':
				A.discard(a[j])
		for j in range(per, per + 26):
			if a[j] == '?':
				a[j] = A.pop()
		for j in range(len(a)):
			if a[j] == '?':
				a[j] = 'A'
		print(''.join(a))


from os import path
import sys
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def solve():
	s = si()
	s = list(s)
	s.pop()
	n = len(s)
	if n < 26:
		print('-1')
		exit(0)
	x = [0] * 26
	j = 0
	for i in range(25):
		if s[i] == '?':
			continue
		x[ord(s[i]) - ord('A')] += 1
	for i in range(25, n):
		if s[i] != '?':
			x[ord(s[i]) - ord('A')] += 1
		if max(x) < 2:
			s1 = []
			for k in range(26):
				if x[k] == 0:
					s1.append(chr(65 + k))
			k1 = 0
			for k in range(j, i + 1):
				if s[k] == '?':
					s[k] = s1[len(s1) - 1]
					s1.pop()
			for k in range(i):
				if s[k] == '?':
					s[k] = 'A'
			for k in range(i + 1, n):
				if s[k] == '?':
					s[k] = 'A'
			print(''.join(s))
			exit(0)
		else:
			if s[j] != '?':
				x[ord(s[j]) - ord('A')] -= 1
			j += 1
	print('-1')
if path.exists('input1.txt'):
	sys.stdin = open('input1.txt', 'r')
	sys.stdout = open('output1.txt', 'w')
else:
	input = sys.stdin.readline
solve()


w = input()
l = len(w)
if l < 26:
	print(-1)
	exit()
(start, allletters) = ('', set())
for i in range(ord('A'), ord('A') + 26):
	allletters.add(chr(i))
for i in range(l - 25):
	(s, count, sub) = (set(), 0, list(w[i:i + 26]))
	for j in sub:
		if j == '?':
			count += 1
		else:
			s.add(j)
	if len(s) + count == 26:
		allletters -= s
		for k in range(len(sub)):
			if sub[k] == '?':
				sub[k] = allletters.pop()
		end = ''
		for x in range(i + 26, l):
			if w[x] == '?':
				end += 'A'
			else:
				end += w[x]
		print(start + ''.join(sub) + end)
		exit()
	if w[i] == '?':
		start += 'A'
	else:
		start += w[i]
print(-1)


freq = [0] * 26
s = list(input().strip())
if len(s) < 26:
	exit(print(-1))
(l, r) = (0, 26)
sub = s[l:r]
for letter in sub:
	if letter != '?':
		freq[ord(letter) - ord('A')] += 1
found = False
while True:
	if max(freq) <= 1:
		if sub.count('?') == freq.count(0):
			found = True
			for i in range(26):
				if freq[i] == 0:
					sub[sub.index('?')] = chr(i + ord('A'))
			s = s[:l] + sub + s[r:]
			break
	l += 1
	r += 1
	if r > len(s):
		break
	removed = sub.pop(0)
	if removed != '?':
		freq[ord(removed) - ord('A')] -= 1
	sub.append(s[r - 1])
	if sub[-1] != '?':
		freq[ord(sub[-1]) - ord('A')] += 1
if not found:
	print(-1)
else:
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'A'
	print(''.join(s))


s = input()
marks = 0
alphabit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
missed = ''
sub_s = ''
s_length = len(s)
i = 0
while i + 26 <= s_length:
	marks = 0
	missed = ''
	sub_s = s[i:i + 26]
	for ch in alphabit:
		if ch not in sub_s:
			missed += ch
	marks = sub_s.count('?')
	if marks >= len(missed):
		sub_s = sub_s[::-1]
		for ch in missed[::-1]:
			sub_s = sub_s.replace('?', ch, 1)
		s = s[:i] + sub_s[::-1] + s[i + 26:]
		s = s.replace('?', 'A')
		print(s)
		exit(0)
	i += 1
print(-1)


s = list(input())
from collections import Counter
n = len(s)
if n < 26:
	print(-1)
	exit()
f = 0
for i in range(n - 25):
	curr = s[i:i + 26]
	c = Counter(curr)
	if all((c[chr(m)] <= 1 for m in range(65, 91))):
		f = 1
		req = []
		for z in range(65, 91):
			if c[chr(z)] == 0:
				req.append(chr(z))
		curr = list(curr)
		j = 0
		for ind in range(26):
			if curr[ind] == '?':
				curr[ind] = req[j]
				j += 1
		for x in range(i):
			if s[x] == '?':
				s[x] = 'A'
		for x in range(i + 26, n):
			if s[x] == '?':
				s[x] = 'A'
		res = s[0:i] + curr + s[i + 26:]
		print(*res, sep='')
		break
if f == 0:
	print(-1)


IL = lambda : list(map(int, input().split()))
IS = lambda : input().split()
I = lambda : int(input())
S = lambda : input()
s = S()
for i in range(len(s) - 25):
	subs = s[i:][:26]
	uniql = set(subs)
	if len(uniql) - ('?' in uniql) + subs.count('?') == 26:
		for ordl in range(65, 91):
			if not chr(ordl) in subs:
				subs = subs.replace('?', chr(ordl), 1)
		print((s[:i] + subs + s[i + 26:]).replace('?', 'A'))
		quit()
print(-1)


s = str(input())
s = s.strip()
k = 0
result = False
while True:
	if len(s) - k < 26:
		break
	t = s[k:26 + k]
	k = k + 1
	x = set(t)
	b = t.count('?')
	if '?' in x:
		x.remove('?')
	if len(x) + b == 26:
		result = True
		t = list(t)
		for i in range(len(t)):
			if t[i] == '?':
				for z in range(26):
					if chr(ord('A') + z) not in t:
						t[i] = chr(ord('A') + z)
						break
		res = ''.join(t)
		res = s[0:k - 1] + res
		res = res + s[26 + k - 1:]
		res = res.replace('?', 'A')
		print(res)
		break
if not result:
	print('-1')


def fill_uniq(nice, cts):
	l_nice = list(nice)
	letters = [chr(ord('A') + i) for i in range(26) if not cts[i]]
	l_i = 0
	for (i, c) in enumerate(l_nice):
		if c == '?':
			l_nice[i] = letters[l_i]
			l_i += 1
	return ''.join(l_nice)

def ans(s, i, cts):
	nice = s[i:i + 26]
	return s[:i].replace('?', 'A') + fill_uniq(nice, cts) + s[i + 26:].replace('?', 'A')

def main():
	s = input()
	if len(s) < 26:
		print(-1)
		return
	cts = [0] * 26
	for c in s[:26]:
		if c == '?':
			continue
		cts[ord(c) - ord('A')] += 1
	max_ct = max(cts)
	if max_ct <= 1:
		print(ans(s, 0, cts))
		return
	for i in range(1, len(s) - 26 + 1):
		if s[i - 1] != '?':
			cts[ord(s[i - 1]) - ord('A')] -= 1
		if s[i + 25] != '?':
			cts[ord(s[i + 25]) - ord('A')] += 1
		max_ct = max(cts)
		if max_ct <= 1:
			print(ans(s, i, cts))
			return
	print(-1)
main()


from collections import Counter
d = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
s = input()
s = list(map(str, s))
if len(s) < 26:
	print(-1)
else:
	for i in range(min(len(s) - 26, len(s)) + 1):
		l = s[i:i + 26]
		c = Counter(l)
		flag = 0
		for j in c:
			if j != '?' and c[j] > 1:
				flag = -1
				break
		if flag != -1:
			for j in l:
				if j in d:
					d[j] = 1
			for j in range(i, i + 26):
				if s[j] == '?':
					for k in d:
						if d[k] == 0:
							s[j] = k
							d[k] = 1
							break
			for j in range(len(s)):
				if s[j] == '?':
					s[j] = 'A'
			break
	if flag == 0:
		print(''.join(s))
	else:
		print(-1)


c = input()
t = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = len(c)
s = {}
k = 0
i = 0
f = 0
while i < n:
	if c[i] != '?':
		if c[i] in s.keys():
			i = s[c[i]]
			k = 0
			s = {}
		else:
			k += 1
			s[c[i]] = i
	else:
		k += 1
	if k == 26:
		f = 1
		break
	i += 1
if f == 1:
	pf = c[:i - 25].replace('?', 'A')
	sf = c[i + 1:].replace('?', 'A')
	x = list(c[i - 25:i + 1])
	for i in range(26):
		if x[i] != '?':
			t.remove(x[i])
	for i in range(26):
		if x[i] == '?':
			x[i] = t.pop(0)
	print(pf + ''.join(x) + sf)
else:
	print(-1)


s = input()
track = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
track[s[0]] = 1
i = 0
j = 1
possible = False
while j < len(s):
	if s[j] == '?' or not track[s[j]]:
		if s[j] != '?':
			track[s[j]] = 1
		if j - i + 1 == 26:
			possible = True
			break
		j += 1
	else:
		while s[i] != s[j]:
			if s[i] != '?':
				track[s[i]] = 0
			i += 1
		i += 1
		j += 1
if possible:
	ans = ''
	for c in range(i):
		if s[c] == '?':
			ans += 'A'
		else:
			ans += s[c]
	for c in range(i, j + 1):
		if s[c] != '?':
			ans += s[c]
		else:
			for (k, v) in track.items():
				if v == 0:
					ans += k
					track[k] = 1
					break
	for c in range(j + 1, len(s)):
		if s[c] == '?':
			ans += 'A'
		else:
			ans += s[c]
	print(ans)
else:
	print(-1)


s = [str(x) for x in input()]
a = 0
mm = 0

def ref(q, w):
	global s, a, mm
	d = {}
	dd = dict(zip([str(chr(x)) for x in range(65, 91)], [0] * 26))
	ddd = []
	a = -1
	for i in range(q, w):
		d[s[i]] = 0
	for i in range(q, w):
		d[s[i]] += 1
		dd.pop(s[i], None)
	if '?' in d.keys():
		if len(d) - 1 + d['?'] == 26:
			a = 1
	elif len(d) == 26:
		a = 1
	for x in dd.keys():
		ddd.append(x)
	if a == 1:
		mm = 228
		for i in range(q, w):
			if s[i] == '?':
				s[i] = ddd[len(ddd) - 1]
				ddd.pop(len(ddd) - 1)
for i in range(26, len(s) + 1):
	(q, w) = (i - 26, i)
	ref(q, w)
	if mm == 228:
		break
if len(s) < 26:
	a = -1
for i in range(len(s)):
	if s[i] == '?':
		s[i] = 'A'
if a != -1:
	print(''.join(s))
else:
	print(a)


from collections import *
from sys import stdin

def fill(ix, c):
	(mem, ch) = (defaultdict(int, c), ord('A'))
	for i in range(ix, l):
		if n[i] == '?':
			while True:
				if ch > ord('Z'):
					n[i] = 'A'
					break
				if not mem[chr(ch)]:
					(n[i], mem[chr(ch)]) = (chr(ch), 1)
					ch += 1
					break
				ch += 1
	return
(n, p1) = (list(stdin.readline()[:-1]), 26)
l = len(n)
if l < p1:
	print(-1)
else:
	flag = -1
	for i in range(l - 25):
		c = Counter(list(filter(lambda x: x != '?', n[i:i + 26])))
		if not c or max(c.values()) == 1:
			flag = 0
			fill(i, c)
			break
		if n[i] == '?':
			n[i] = 'A'
	print(flag if flag else ''.join(n))


def main():
	s = input()
	n = len(s)
	if n < 26:
		print(-1)
		return
	s = list(s)
	n = len(s)
	j = 0
	x = ord('A')
	a = [0] * 26
	while j + 26 <= n:
		flag = 1
		for k in range(j, j + 26):
			if s[k] != '?':
				if a[ord(s[k]) - x] == 0:
					a[ord(s[k]) - x] = 1
				else:
					a = [0] * 26
					j = j + 1
					flag = 0
					break
		if flag == 1:
			p = 0
			for k in range(j, j + 26):
				if s[k] == '?':
					while a[p] != 0:
						p += 1
					s[k] = chr(x + p)
					p += 1
			for i in range(n):
				if s[i] == '?':
					s[i] = 'A'
			print(''.join(s))
			return
	print(-1)

def __starting_point():
	main()
__starting_point()


l = list(input())
n = len(l)
fail = True
for i in range(n - 25):
	good = True
	visited = [False for _ in range(26)]
	for j in range(26):
		if l[i + j] == '?':
			continue
		if visited[ord(l[i + j]) - ord('A')]:
			good = False
			break
		else:
			visited[ord(l[i + j]) - ord('A')] = True
	if good:
		j = 0
		for k in range(26):
			if visited[k]:
				continue
			while l[i + j] != '?':
				j += 1
			l[i + j] = chr(ord('A') + k)
		fail = False
		break
if fail:
	print(-1)
else:
	for i in range(n):
		if l[i] == '?':
			l[i] = 'A'
	print(''.join(l))


import collections

def GetWord(word, start_index, letter_dict, letters):
	good_word = ''
	for i in range(start_index):
		if word[i] != '?':
			good_word += word[i]
		else:
			good_word += 'A'
	for i in range(start_index, start_index + 26):
		if word[i] != '?':
			good_word += word[i]
		else:
			for j in range(26):
				if letter_dict[letters[j]] == 0:
					good_word += letters[j]
					letter_dict[letters[j]] += 1
					break
	for i in range(start_index + 26, len(word)):
		if word[i] != '?':
			good_word += word[i]
		else:
			good_word += 'A'
	return good_word

def CompleteWord():
	word = input()
	letter_count = {}
	letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	for i in letters:
		letter_count[i] = 0
	n = len(word)
	letter_count = dict(collections.OrderedDict(sorted(letter_count.items())))
	for i in range(n - 25):
		letter_count_temp = letter_count.copy()
		count = 0
		for j in range(i, i + 26):
			if word[j] != '?':
				letter_count_temp[word[j]] += 1
			else:
				count += 1
		total = 0
		count1 = 0
		for k in letter_count_temp:
			if letter_count_temp[k] == 1 or letter_count_temp[k] == 0:
				total += 1
				if letter_count_temp[k] == 0:
					count1 += 1
		if total == 26:
			if count == count1:
				return GetWord(word, i, letter_count_temp, letters)
	return '-1'
print(CompleteWord())


s = input()
alph = set('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
if len(s) >= 26:
	ans = -1
	l = 0
	r = 25
	if '?' not in s:
		while ans != 'yes' and r < len(s):
			if set(s[l:r + 1]) == alph:
				ans = 'yes'
			l += 1
			r += 1
		if ans == 'yes':
			print(s)
		else:
			print(-1)
	else:
		while ans != 'yes' and r < len(s):
			if len(set(s[l:r + 1])) - 1 + s[l:r + 1].count('?') == 26:
				ans = 'yes'
				a = set(s[l:r + 1])
				dif = alph - a
				dif = list(dif)
				s = list(s)
				for i in range(l, r + 1):
					if s[i] == '?':
						s[i] = dif.pop()
				for i in range(len(s)):
					if s[i] == '?':
						s[i] = 'A'
			l += 1
			r += 1
		if ans == 'yes':
			for item in s:
				print(item, end='')
		else:
			print(-1)
else:
	print(-1)


char = 'QWERTYUIOPASDFGHJKLZXCVBNM'

def fix(s):
	if s.count('?') == 0:
		return s
	i = s.index('?')
	for c in char:
		if c not in s:
			return fix(s[0:i] + c + s[i + 1:26])
s = input()
n = len(s)
r = -1
flag = False
if n < 26:
	print(-1)
else:
	for i in range(0, n - 25):
		flag = False
		for j in range(i, i + 25):
			if s[j] == '?':
				continue
			for k in range(j + 1, i + 26):
				if s[j] == s[k]:
					flag = True
					break
			if flag == True:
				break
		else:
			r = i
			s1 = s[0:r].replace('?', 'A')
			s2 = fix(s[r:r + 26])
			s3 = s[r + 26:n].replace('?', 'A')
			print(s1 + s2 + s3)
			break
	else:
		print(-1)


def main():
	try:
		while True:
			s = input()
			if len(s) < 26:
				print(-1)
				continue
			fq = [0] * 26
			bad_count = 0
			for c in s[:26]:
				if c != '?':
					c = ord(c) - 65
					fq[c] += 1
					if fq[c] == 2:
						bad_count += 1

			def check(pos):
				if bad_count > 0:
					return False
				ls = list(s)
				cur = 0
				for (i, c) in enumerate(s[pos - 26:pos], pos - 26):
					if c == '?':
						while fq[cur] > 0:
							assert fq[cur] == 1
							cur += 1
						ls[i] = chr(cur + 65)
						fq[cur] = 1
				print(''.join(ls).replace('?', 'A'))
				return True
			for (i, c) in enumerate(s[26:], 26):
				if check(i):
					break
				if s[i - 26] != '?':
					c0 = ord(s[i - 26]) - 65
					fq[c0] -= 1
					if fq[c0] == 1:
						bad_count -= 1
				if c != '?':
					c = ord(c) - 65
					fq[c] += 1
					if fq[c] == 2:
						bad_count += 1
			else:
				if not check(len(s)):
					print(-1)
	except EOFError:
		pass
main()


def have_ans(sl, s1, sr, used):
	sl = list(sl)
	for i in range(len(sl)):
		if sl[i] == '?':
			sl[i] = 'A'
	sl = ''.join(sl)
	sr = list(sr)
	for i in range(len(sr)):
		if sr[i] == '?':
			sr[i] = 'A'
	sr = ''.join(sr)
	free_letters = ''
	track_f_letters = 0
	for i in used:
		if used[i] == 0 and i != '?':
			free_letters += i
	outans = ''
	for st in s1:
		if st == '?':
			outans += free_letters[track_f_letters]
			track_f_letters += 1
		else:
			outans += st
	out = sl + outans + sr
	return out[1:]

def ans(s):
	s = '0' + s
	n = len(s)
	if n < 27:
		return -1
	used = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0, 'G': 0, 'H': 0, 'I': 0, 'J': 0, 'K': 0, 'L': 0, 'M': 0, 'N': 0, 'O': 0, 'P': 0, 'Q': 0, 'R': 0, 'S': 0, 'T': 0, 'U': 0, 'V': 0, 'W': 0, 'X': 0, 'Y': 0, 'Z': 0}
	i = 1
	j = 2
	used[s[i]] = 1
	var_used = 1
	sign = 0
	while j < n:
		if s[j] == '?':
			sign += 1
			if sign + var_used > 26:
				if s[i] == '?':
					sign -= 1
				else:
					used[s[i]] = 0
					var_used -= 1
				i += 1
		elif used[s[j]] == 0:
			used[s[j]] = 1
			var_used += 1
		else:
			while s[i] != s[j]:
				used[s[i]] = 0
				var_used -= 1
				i += 1
			i += 1
		if j - i == 25:
			return have_ans(s[0:i], s[i:j + 1], s[j + 1:], used)
		j += 1
	return -1
s = input()
print(ans(s))


s = list(input())
full = {'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'}
avi = set(s)
flag = 0
i = 0
D = set()
count = 0
dic = {}
ind = 0
if '?' not in s:
	while i < len(s):
		if s[i] in D:
			count = 0
			i = dic[s[i]] + 1
			dic = {}
			D = set()
			continue
		elif s[i] == '?':
			count = count + 1
			i = i + 1
		else:
			D.add(s[i])
			count = count + 1
			dic[s[i]] = i
			i = i + 1
		if count == 26:
			ind = -1
			break
	if ind == -1:
		print(*s, sep='')
	else:
		print(-1)
else:
	avi.remove('?')
	count = 0
	D = set()
	ind = 0
	dic = {}
	i = 0
	while i < len(s):
		if s[i] in D:
			count = 0
			i = dic[s[i]] + 1
			dic = {}
			D = set()
			continue
		elif s[i] == '?':
			count = count + 1
			i = i + 1
		else:
			D.add(s[i])
			count = count + 1
			dic[s[i]] = i
			i = i + 1
		if count == 26:
			ind = i
			break
	if ind == 0:
		print(-1)
	else:
		last = ind - 1
		ind = ind - 26
		c = full - D
		for i in range(len(s)):
			if s[i] == '?':
				if i >= ind and i <= last and (len(c) > 0):
					s[i] = c.pop()
				else:
					s[i] = 'A'
		print(*s, sep='')


from string import ascii_uppercase
w = list(ascii_uppercase)

def c(s):
	for i in range(len(s)):
		for j in range(i + 1, len(s)):
			if s[j] == s[i] and s[j] != '?':
				return -1
	return 1
s = input()
flag = False
l = []
for i in range(len(s) - 25):
	s2 = list(s[i:i + 26])
	if c(s2) == 1:
		k = i
		flag = True
		for j in range(len(s2)):
			if s2[j] != '?':
				w.remove(s2[j])
		for j in range(len(s2)):
			if s2[j] == '?':
				s2[j] = w[0]
				w.remove(w[0])
		break
if flag == False:
	print('-1')
else:
	s = list(s)
	s[k:k + 26] = s2
	for i in range(len(s)):
		if s[i] == '?':
			s[i] = 'A'
	for x in s:
		print(x, end='')


def f(d):
	for elem in d:
		if d[elem] == 0:
			d[elem] = 1
			return elem
s = input()
a = list(s)
dictionary = dict()
letter = 'A'
for i in range(26):
	dictionary[letter] = 0
	x = ord(letter)
	letter = chr(x + 1)
if len(s) < 26:
	print(-1)
else:
	sub_c = len(s) - 25
	for j in range(sub_c):
		count = 0
		d = dict(dictionary)
		for i in range(j, j + 26):
			if s[i] != '?':
				d[s[i]] += 1
				if d[s[i]] > count:
					count = d[s[i]]
		if count > 1 and j == sub_c - 1:
			print(-1)
		elif count > 1:
			continue
		else:
			for k in range(j, j + 26):
				if a[k] == '?':
					a[k] = f(d)
			for h in range(len(a)):
				if a[h] == '?':
					a[h] = 'A'
				print(a[h], end='')
			break


S = input()
if len(S) < 26:
	print(-1)
else:
	ma = ''
	for i in range(len(S) - 25):
		g = 0
		d = S[i:i + 26]
		v = len(set(d))
		g = d.count('?')
		if g > 0:
			v = v - 1
		if v + g == 26 or g == 26:
			ma = d
			r = i
			break
	R = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	if ma == '':
		print(-1)
	else:
		T = ''
		for i in range(len(ma)):
			if ma[i] != '?':
				T = T + ma[i]
			else:
				for i in range(len(R)):
					if R[i] not in T and R[i] not in ma:
						T = T + R[i]
						break
		m = S[:r]
		m = m.replace('?', 'A')
		g = S[r + 26:]
		g = g.replace('?', 'A')
		print(m + T + g)


import random

def main():
	s = input()
	ans = list(s)
	ok = False
	if len(s) >= 26:
		lookup = {}
		start = 0
		end = 0
		k = 0
		count = [0] * 26
		comma = 0
		while end < len(s):
			while end - start + 1 <= 26:
				if s[end] == '?':
					comma += 1
				else:
					if count[ord(s[end]) - ord('A')] == 0:
						k += 1
					count[ord(s[end]) - ord('A')] += 1
				end += 1
			if k + comma == 26:
				for i in range(start, end):
					if s[i] == '?':
						for j in range(26):
							if count[j] == 0:
								ans[i] = chr(ord('A') + j)
								count[j] += 1
								break
				ok = True
				break
			else:
				if s[start] == '?':
					comma -= 1
				else:
					count[ord(s[start]) - ord('A')] -= 1
					if count[ord(s[start]) - ord('A')] == 0:
						k -= 1
				start += 1
		if ok:
			for i in range(len(s)):
				if ans[i] == '?':
					ans[i] = chr(ord('A') + random.randint(0, 25))
			print(''.join(ans))
		else:
			print(-1)
	else:
		print(-1)
main()


import string
s = input()
for i in range(len(s)):
	cur = list(s[i:i + 26])
	if len(cur) < 26:
		continue
	does_not_have = [x for x in string.ascii_uppercase if x not in cur]
	bad_index = [i for (i, j) in enumerate(cur) if j == '?']
	if len(does_not_have) == len(bad_index):
		for (x, y) in zip(does_not_have, bad_index):
			cur[y] = x
		s = s[:i] + ''.join(cur) + s[i + 26:]
		s = s.replace('?', 'A')
		print(s)
		break
else:
	print(-1)


from collections import Counter
s = list(input())
abc = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans = False
for i in range(len(s)):
	substr = s[i:i + 26]
	if len(substr) < 26:
		break
	if sorted(substr) == abc:
		ans = True
		break
	cnt = Counter(substr)
	if [x[0] for x in cnt.most_common() if x[1] > 1 and x[0] != '?']:
		continue
	elif cnt['?'] < len([x[0] for x in cnt.most_common() if x[1] == 0 and x[0] != '?']):
		continue
	else:
		p = []
		for j in range(i, i + 26):
			if s[j] == '?':
				p.append(j)
		for i in range(ord('A'), ord('Z') + 1):
			c = chr(i)
			if cnt[c] == 0:
				s[p[0]] = c
				p = p[1:]
		ans = True
		break
print(''.join(s).replace('?', 'A') if ans else -1)


from collections import Counter

def fill_str(tmps, tmpc):
	S = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	for c in S:
		if c not in tmpc:
			tmps = tmps.replace('?', c, 1)
	return tmps

def get_ans():
	S = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	C = Counter(S)
	s = input()
	ls = len(s)
	if ls < 26:
		return -1
	for i in range(ls - 26 + 1):
		tmps = s[i:i + 26]
		tmpc = Counter(tmps)
		if tmpc == C:
			sleft = s[:i]
			sright = s[i + 26:]
			filled_sleft = sleft.replace('?', 'A')
			filled_sright = sright.replace('?', 'A')
			return filled_sleft + tmps + filled_sright
		else:
			sum_freq = 0
			double = False
			freq_question_mark = tmpc['?']
			for (k, v) in tmpc.items():
				if k == '?':
					continue
				if v != 1:
					double = True
					break
				sum_freq += v
			if double:
				continue
			if sum_freq + freq_question_mark == 26:
				sleft = s[:i]
				sright = s[i + 26:]
				filled_sleft = sleft.replace('?', 'A')
				filled_sright = sright.replace('?', 'A')
				t2 = fill_str(tmps, tmpc)
				return filled_sleft + t2 + filled_sright
	return -1
ans = get_ans()
print(ans)


def fn(l):
	ls = ['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']
	l1 = []
	for i in range(26):
		if ls[i] not in l:
			l1.append(ls[i])
	return l1

def fn1(s):
	ls = ['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 i in range(len(s) - 25):
		l1 = list(s[i:i + 26])
		flag = True
		for j in range(26):
			if ls[j] not in l1:
				flag = False
		if flag == True:
			return True
	return False
s = str(input())
l = list(s)
n = len(s)
flag = False
ls = ['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 i in range(n - 25):
	l1 = l[i:i + 26]
	m = fn(l1)
	if l1.count('?') == len(m) and len(m) > 0:
		flag = True
		for j in range(len(m)):
			ind = l1.index('?')
			l1[ind] = m[j]
		for j in range(26):
			l[i + j] = l1[j]
		for k in range(n):
			if l[k] == '?':
				l[k] = 'A'
		print(''.join(l))
		exit()
if l.count('?') > 0 or fn1(s) == False:
	print(-1)
else:
	print(s)