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.

Difficulty: EASY

Solutions:
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()


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()


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))


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)


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()


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)


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='')


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 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()


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


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)


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)


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)


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)


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='')


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)


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')


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 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)


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)


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()
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)


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)


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)


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)


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)


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()
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')


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()
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='')


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()
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)


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')


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 = 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()


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)


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='')


__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')


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)


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)


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())


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))


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 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)