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?

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.

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.

NoteIn 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.

var x:char;
    flag:array[1..26] of boolean;
	ch:array[1..60000] of char;
	i,j,k,ans,now,n:longint;
begin
  n:=0;
  while not(eoln) do
  begin
    inc(n);
    read(ch[n]);
  end;
  readln;
  for i:=1 to n-25 do
  begin
    fillchar(flag,sizeof(flag),false);
    ans:=0;
    now:=0;
    for j:=1 to 26 do
		if (ch[i+j-1]<>'?') then flag[ord(ch[i+j-1])-64]:=true else inc(ans);
	for j:=1 to 26 do
		if not(flag[j]) then inc(now);
	if (ans>=now) then
	begin
	  now:=1;
	  for k:=1 to i-1 do
		if (ch[k]<>'?') then write(ch[k]) else write('A');
	  for k:=i to i+25 do
		if (ch[k]<>'?') then write(ch[k]) else
		begin
		  while (now<=25) and flag[now] do inc(now);
		  flag[now]:=true;
		  write(chr(now+64));
		end;
	  for k:=i+26 to n do
		if (ch[k]<>'?') then write(ch[k]) else write('Z');
	  writeln;
	  halt;
	end;
  end;
  writeln('-1');
end.

var
	s,s1 : ansistring;
	i,j,a,hah : longint;
	k : char;
	cek : boolean;
	ada : array['A'..'Z'] of boolean;

begin
	readln(s);
	cek := false;
	if length(s) < 26 then begin
		writeln(-1);
		exit;
	end;
	for i := 1 to (length(s)-25) do begin
		hah := 0;
		for k := 'A' to 'Z' do ada[k] := false;
		for j := i to i+25 do begin
			if ada[s[j]] then hah := 1;
			if s[j] <> '?' then ada[s[j]] := true;
		end;
		if hah = 0 then begin
			for j := i to i+25 do begin
				if s[j] = '?' then begin
					for k := 'A' to 'Z' do begin
						a := 0;
						if not(ada[k]) then begin
							s[j] := k;
							ada[k] := true;
							a := 1;
						end;
						if a = 1 then break;
					end;
				end;
			end;
			s1 := copy(s,i,26);
			if pos('?',s1) = 0 then cek := true;
		end;
	end;
	while pos('?',s) <> 0 do s[pos('?',s)] := 'V';
	if cek then writeln(s)
	else writeln(-1);
end.

var
s:ansistring;
a,b:array[0..50050] of longint;
c:array[0..26] of boolean;
i,j,len,cnt:longint;

procedure print(x:longint);
var i,cnt:longint;
begin
  for i:=x to x+25 do
  if a[i]<>0 then c[a[i]]:=true;
  cnt:=1;
  for i:=x to x+25 do
  if a[i]=0 then
  begin
    while (cnt<26)and(c[cnt]=true) do inc(cnt);
    a[i]:=cnt;c[cnt]:=true;
  end;
  for i:=1 to len do
  if a[i]=0 then write('Z') else write(chr(a[i]+ord('A')-1));
  writeln;
  halt;
end;

begin
  readln(s);
  len:=length(s);
  if len<26 then
  begin
    writeln('-1');
    halt;
  end;
  for i:=1 to len do
  if s[i]<>'?' then
  a[i]:=ord(s[i])-ord('A')+1;
  for i:=1 to 26 do inc(b[a[i]]);
  for i:=1 to len-25 do
  begin
    cnt:=b[0];
    for j:=1 to 26 do
    if b[j]<>0 then inc(cnt);
    if cnt=26 then print(i);
    dec(b[a[i]]);
    if i+26<=len then inc(b[a[i+26]]);
  end;
  writeln('-1');
end.

{$H+}
var a:array['A'..'Z'] of longint;
    s,ss:string;
    ii:char;
    i,j,h,kol,p:longint;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);}
read(s);
if length(s)<26 then begin writeln('-1'); halt; end;
for i:=1 to length(s)-25 do
 begin
 for ii:='A' to 'Z' do
   a[ii]:=0;
 kol:=0;
 p:=0;
 for j:=1 to 26 do
   if s[i+j-1]='?' then inc(kol)
                   else
                        if a[s[i+j-1]]=0 then a[s[i+j-1]]:=1
                                         else begin p:=1; break; end;
  if p=0 then begin
              for j:=1 to i-1 do
                if s[j]='?' then write('A')
 else write(s[j]);
              for j:=1 to 26 do
                if s[i+j-1]='?' then begin
                                     for ii:='A' to 'Z' do
                                       if a[ii]=0 then begin
                                                       a[ii]:=1;
                                                       write(ii);
                                                       break;
                                                       end;
                                     end
                                 else write(s[i+j-1]);
                for j:=i+j to length(s) do
                       if s[j]='?' then write('A')
 else write(s[j]);

                halt;
                end;
 end;
writeln('-1');
{close(input);
close(output);   }
end.

var
n,i,j,j1,p:longint;
st,st2,st3:ansistring;
a:array[0..100] of int64;
procedure prov;
 begin
  for j:=1 to 26 do
  begin
   if a[j]>1 then exit;
  end;
  for j:=1 to 26 do
   begin
    if a[j]=0 then begin
    if i=0 then i:=26;
                    for j1:=i-25 to i do
                     begin
                      if st[j1]='?' then begin
                                          st[j1]:=st3[j];
                                          break;
                                         end;
                     end;
                   end;
   end;
   for j:=i to n do
    if st[j]='?' then st[j]:='A';
   writeln(st);
   halt;
 end;
begin
 readln(st);
 n:=length(st);
 st3:='QWERTYUIOPASDFGHJKLZXCVBNM';
 if n<26  then begin
                writeln('-1');
                halt;
               end;
 st2:=copy(st,1,26);
 for i:=1 to 26 do
  begin
   if st2[i]<>'?' then begin
                       p:=pos(st2[i],st3);
                       a[p]:=a[p]+1;
                       end;
  end;
  prov;
 for i:=27 to n do
  begin
   p:=pos(st[i],st3);
   a[p]:=a[p]+1;
   p:=pos(st[i-26],st3);
   a[p]:=a[p]-1;
   if st[i-26]='?' then st[i-26]:='A';
   prov;
  end;
  writeln(-1);
end.

var i,j,m,n,len,k:longint;
    pfx:array[0..50005,0..25]of longint;
    s:ansistring;
    used:array[0..25]of boolean;
    flag:boolean;
begin
    readln(s);
    len:=length(s);
    for i:=1 to len do begin
       if s[i]='?' then begin
           for j:=0 to 25 do pfx[i,j]:=pfx[i-1,j];
       end else begin
           for j:=0 to 25 do if ord('A')+j<>ord(s[i]) then pfx[i,j]:=pfx[i-1,j] else pfx[i,j]:=pfx[i-1,j]+1;
       end;
    end;

    if len<26 then writeln(-1) else begin
        for i:=1 to len-25 do begin
            flag:=true;
            for j:=0 to 25 do begin
                if pfx[i+25,j]-pfx[i-1,j]>1 then flag:=false;
            end;
            if flag then begin
               for j:=1 to i-1 do if s[j]='?' then write('A') else write(s[j]);
               fillchar(used,sizeof(used),false);
               for j:=i to i+25 do if s[j]<>'?' then used[ord(s[j])-ord('A')]:=true;
               //writeln(i);

               for j:=i to i+25 do begin
                   if s[j]<>'?' then write(s[j]) else begin
                       for k:=0 to 25 do if used[k]=false then begin
                           write(chr(k+ord('A')));
                           used[k]:=true;
                           break;
                       end;
                   end;
               end;
               for j:=i+26 to len do if s[j]='?' then write('A') else write(s[j]);
               writeln;
               //close input output
               halt;
            end;
        end;
        writeln(-1);
    end;
    //writeln(-1);
end.

        {$mode objfpc}
        {$coperators on}
uses math;
const
        {$ifdef online_judge}  fi=''; fo='';
        {$else} fi='inp.inp';
                fo='out.out';
        {$endif}

var
        f       :       array['A'..'Z']of longint;
        q       :       longint;
        s, res, rr, rrr  :       ansistring;
        mis     :       array[1..40] of char;
procedure enter;
var i, j : integer;
        begin
                readln(s);
                if length(s)<26 then
                        begin
                                writeln(-1); halt;
                        end;
        end;
procedure ahihi(l,r:longint);
var i:char; b:boolean; c, ii:longint;
        begin
                c:=0;
                for i:='A' to 'Z' do if f[i]=0 then
                        begin
                                inc(c);
                                mis[c]:=i;
                        end;
                if q=c then
                        begin
                                for ii:=1 to l-1 do if s[ii]<>'?' then write(s[ii]) else write('A');
                                c:=1;
                                for ii:=l to r do
                                        begin
                                                if s[ii]<>'?' then write(s[ii]) else
                                                 begin
                                                        write(mis[c]);
                                                        c+=1;
                                                 end;
                                        end;
                                for ii:=r+1 to length(s) do if s[ii]<>'?' then write(s[ii]) else write('A');
                                halt;
                        end;
        end;
procedure solve;
var i, j : integer;
        begin
                q:=0;
                for i:=1 to 26 do
                        begin
                                if s[i]<>'?' then f[s[i]]+=1 else q:=q+1;
                        end;
                i:=1; j:=26;
                while(j<=length(s))do
                        begin
                                ahihi(i,j);
                                if s[i]<>'?' then f[s[i]]-=1 else q-=1;
                                i+=1; j+=1;
                                if j>length(s) then break;
                                if s[j]<>'?' then f[s[j]]+=1 else q+=1;
                        end;
                writeln(-1);
        end;
begin

        assign(input, fi); assign(output, fo); reset(input);  rewrite(output);
        enter;
        solve;
        close(input); close(output);
end.

{$H+}
var
        i,res,sn : longint;
        c : char;
        st : string;
        ok,ok2 : boolean;
        s : array['A'..'Z',0..50000] of longint;
        sc : array[0..50000] of char;

begin
        readln(st);
        for i := 1 to length(st) do
                for c := 'A' to 'Z' do
                        s[c,i] := s[c,i-1] + ord(c = st[i]);
        ok := false;
        for i := 1 to length(st) - 26 + 1 do
                begin
                        ok2 := true;
                        for c := 'A' to 'Z' do
                                if s[c,i+25] - s[c,i-1] > 1 then
                                        begin
                                                ok2 := false;
                                                break;
                                        end;
                        if ok2 then
                                begin
                                        ok := true;
                                        res := i;
                                        break;
                                end;
                end;
        if ok then
                begin
                        for c := 'A' to 'Z' do
                                if s[c,i+25] - s[c,i-1] = 0 then
                                        begin
                                                inc(sn);
                                                sc[sn] := c;
                                        end;
                        for i := res to res + 25 do
                                if st[i] = '?' then
                                        begin
                                                st[i] := sc[sn];
                                                dec(sn);
                                        end;
                        for i := 1 to length(st) do
                                if st[i] = '?' then st[i] := 'A';
                        writeln(st);
                end
        else writeln(-1)
end.

const
   tfi='';
   tfo='';

var
   fi, fo: text;
   s: ansistring;
   f, res: array[0..27] of boolean;

procedure __;
var
   i, j, empty, cnt, dau, cuoi, n: longint;
begin
   assign(fi, tfi); reset(fi);
   assign(fo, tfo); rewrite(fo);
   readln(fi, s); n:= length(s);
   if n<26 then
      begin
         writeln(fo, -1); exit;
      end;
   dau := -1;
   for i:=1 to n-26+1 do
      begin
         fillchar(f, sizeof(f), false);
         empty := 0; cnt := 0;
         for j:=i to i+25 do
            if s[j]='?' then inc(empty)
            else if not f[ord(s[j])-64] then
               begin
                  f[ord(s[j])-64] := true;
                  inc(cnt);
               end;
         if cnt+empty=26 then
            begin
               res := f;
               dau := i; cuoi := i+25;
               break;
            end;
      end;
   if dau=-1 then
      begin
         writeln(fo, -1); exit;
      end;
   for i:=1 to n do
      if (dau<=i) and (i<=cuoi) then
         begin
            if s[i]='?' then
               begin
                  for j:=1 to 26 do
                     if not res[j] then
                        begin
                           write(fo, char(j+64)); res[j] := true; break;
                        end;
               end
            else write(fo, s[i]);
         end
      else
         begin
            if s[i]='?' then write(fo, 'A') else write(fo, s[i]);
         end;
end;

procedure _;
begin
   close(fi); close(fo);
end;

BEGIN
   __;
   _;
END.

var a:array[1..26] of longint;
st:ansistring;
n,i,j,nom,nom2,l,r:longint;
sim:char;
f2,f3:boolean;

procedure prov(var f:boolean);
begin
  f:=true;
  for j:=1 to 26 do
    if a[j]>1 then begin
                     f:=false;
                     exit;
                   end;
end;

begin
  readln(st);
  n:=length(st);

  if n<26 then begin
                 writeln(-1);
                 halt;
               end;
  for i:=1 to 26 do
    begin
      sim:=st[i];
      if sim<>'?' then begin
                         nom:=ord(sim);
                         nom2:=nom-64;
                         a[nom2]:=a[nom2]+1;
                       end;
    end;

  f3:=false;
  prov(f2);
  if f2=true then
             begin
               l:=1;
               r:=26;
               f3:=true;
             end;

  for i:=27 to n do
    begin
      sim:=st[i];
      if sim<>'?' then begin
      nom:=ord(sim);
      nom2:=nom-64;
      a[nom2]:=a[nom2]+1;
                       end;

      sim:=st[i-26];
      if sim<>'?' then begin
      nom:=ord(sim);
      nom2:=nom-64;
      a[nom2]:=a[nom2]-1;
                       end;

      prov(f2);
      if f2=true then
                 begin
                   l:=i-25;
                   r:=i;
                   f3:=true;
                   break;
                 end;
    end;

  if f3=false then
              begin
                writeln(-1);
                halt;
              end;

  for i:=1 to 26 do
    begin
      if a[i]=0
        then
           begin
             sim:=chr(i+64);
             for j:=l to r do
               if st[j]='?' then begin
                                   st[j]:=sim;
                                   break;
                                 end;
           end;
    end;

  for i:=1 to n do
    if st[i]='?' then st[i]:='A';

  writeln(st);

end.

var a:array[1..26] of longint;
st,alf:ansistring;
i,n,p,p2,kl,kl2,j,l1,l2:longint;
sim,sim2:char;
begin
  readln(st);
  alf:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  n:=length(st);
  if n<26 then
          begin
            writeln(-1);
            halt;
          end;
  for i:=1 to 26 do
    begin
      sim:=st[i];
      if sim<>'?' then
      begin
      p:=pos(sim,alf);
      a[p]:=a[p]+1;
      end;
    end;

  kl:=0;
  for i:=1 to 26 do
    if a[i]>1 then begin
                     kl:=1;
                     break;
                   end;
  if kl=0 then begin
                 l1:=1;
                 l2:=26;
                 kl2:=1;
               end;

  for i:=27 to n do
    begin
      sim:=st[i];
      if sim<>'?' then
      begin
      p:=pos(sim,alf);
      a[p]:=a[p]+1;
      end;
      sim2:=st[i-26];
      if sim2<>'?' then
      begin
      p2:=pos(sim2,alf);
      a[p2]:=a[p2]-1;
      end;
      kl:=0;
      for j:=1 to 26 do
        if a[j]>1 then begin
                         kl:=1;
                         break;
                       end;
      if kl=0 then begin
                     l1:=i-26+1;
                     l2:=i;
                     kl2:=1;
                     break;
                   end;
    end;

  if kl2=0 then writeln(-1)
  else
  BEGIN
    for i:=1 to 26 do
      if a[i]=0 then
          begin
            for j:=l1 to l2 do
              if st[j]='?' then begin
                                  st[j]:=alf[i];
                                  break;
                                end;
          end;
    for i:=1 to n do
      if st[i]='?' then st[i]:='A';
    writeln(st);
  END;
end.

{$H+}
var
  a, b, c, d, i, j, t: int64;
  s: string;
  q: boolean;
  ar: array [1..1000] of int64;

begin
  readln(s);
  q := false;
  if length(s) < 26 then begin
    writeln(-1);
    halt();
  end;
  i := 1;
  a := 0;
  b := 0;
  while i <= 26 do
  begin
    if s[i] = '?' then begin
      inc(b);
    end
    else if ar[ord(s[i])] = 0 then begin
      ar[ord(s[i])] := 1;
      inc(a);
    end
    else inc(ar[ord(s[i])]);
    inc(i);
  end;
  while i <= length(s) do
  begin
    if a + b = 26 then begin
      j := i - 26;
      q := true;
      while j < i do
      begin
        if s[j] <> '?' then
        else begin
          t := ord('A');
          while t <= ord('Z') do
          begin
            if ar[t] = 0 then begin
              ar[t] := 1;
              s[j] := chr(t);
              break;
            end;
            inc(t);
          end;
        end;
        inc(j);
      end;
    end;
    if s[i - 26] = '?' then dec(b)
    else begin
      if ar[ord(s[i - 26])] = 1 then dec(a);
      dec(ar[ord(s[i - 26])]);
    end;
    if s[i] = '?' then inc(b)
    else begin
      if ar[ord(s[i])] = 0 then inc(a);
      inc(ar[ord(s[i])]);
    end;
    inc(i);
  end;
  if a + b = 26 then begin
    q := true;
    j := i - 26;
    while j < i do
    begin
      if s[j] <> '?' then
      else begin
        t := ord('A');
        while t <= ord('Z') do
        begin
          if ar[t] = 0 then begin
            ar[t] := 1;
            s[j] := chr(t);
            break;
          end;
          inc(t);
        end;
      end;
      inc(j);
    end;
  end;
  if q then begin
    i := 1;
    while i <= length(s) do begin
      if s[i] = '?' then write('A')
      else write(s[i]);
      inc(i);
    end;
  end
  else writeln(-1);
end.

var
i,j,jj,k,x,y,z: longint;
s: ansistring;
a: array['A'..'Z'] of boolean;
c: char;
nice: boolean;
begin
	readln(s);
	if length(s)<26 then
	begin
		writeln(-1);
		halt;
	end;
	for j:= 1 to length(s)-25 do
	begin
		for c:='A' to 'Z' do
			a[c]:=false;
		nice:=true;
		for k:= j to j+25 do
			if s[k]<>'?' then
				if a[s[k]] then
				begin
					nice:=false;
					break;
				end else
				a[s[k]]:=true;
		if nice then
		begin
			z:=j;
			break;
		end;
	end;
	if z=0 then
	begin
		writeln(-1);
		halt;
	end;
	for j:= z to z+25 do
		if s[j]='?' then
			for c:='A' to 'Z' do
				if a[c]=false then
				begin
					a[c]:=true;
					s[j]:=c;
					break;
				end;
	for j:= 1 to length(s) do
		if s[j]='?' then
			s[j]:='A';
	writeln(s);
end.

var s,s1,so:ansistring;
a:array[1..26]of longint;
i,n,f,j,f1,l,k:longint;
begin
readln(so);
for i:=1 to length(so)-25  do
begin
s:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
l:=1;
for j:=i to i+25 do begin
s[l]:=so[j];
l:=l+1;
end;
for j:=1 to 26 do
a[j]:=0;
n:=length(s);
if n<26 then begin writeln(-1); exit; end;
s1:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for l:=1 to 26 do
 for j:=1 to n do
if s1[l]=s[j] then a[l]:=a[l]+1;
l:=1;
while l<=n do begin
if s[l]='?' then   for j:=1 to 26 do
if a[j]=0 then begin
a[j]:=1; s[l]:=s1[j];
break;
end;
l:=l+1;
end;

f:=0;
for l:=1 to 26 do
if a[l]<>1 then f:=1;
if (n=26) and(f=0) then begin f1:=1;k:=1; for j:=i to i+25  do begin  so[j]:=s[k];k:=k+1; end; break; end;
end;
if f1=0 then writeln(-1)
else begin
for i:=1 to length(so) do
if  so[i]='?' then so[i]:='A';
writeln(so);
end;
end.

var s:ansistring;
	count:array[0..50001,0..27] of longint;
	test,check:boolean;
	i,j,k,n,g:longint;
	used:array[0..27] of boolean;
begin
        //assign(input,'716B.inp'); reset(input);
	//assign(output,'716B.out'); rewrite(output);
	readln(s);
	n:=length(s);
	for i:=1 to n do
        begin
                if s[i]<>'?' then count[i,ord(s[i])-64]:=count[i-1,ord(s[i])-64]+1;
                for j:=1 to 26 do if j<>ord(s[i])-64 then count[i,j]:=count[i-1,j];
        end;
	test:=false;
        randomize;
	if n>25 then
	begin
		for i:=1 to n-25 do
		begin
			j:=i+25;
                        check:=false;
			for k:=1 to 26 do
			begin
                                if count[j,k]-count[i-1,k]>1 then check:=true;
				if count[j,k]-count[i-1,k]=1 then used[k]:=true
                                else used[k]:=false;

			end;
			if not check then
			begin
				for k:=i to j do
					if s[k]='?' then
						for g:=1 to 26 do
							if used[g]=false then begin s[k]:=chr(g+64); used[g]:=true; break; end;
				test:=true;
				break;
			end;
		end;
		for i:=1 to n do if s[i]='?' then s[i]:='A';
		if not test then write(-1) else write(s);
	end
	else write(-1);
	//close(input); close(output);
end.

var a:array[0..30] of longint;
st:ansistring;
alf:string;
n,i,j,p,kl,q:longint;
begin
  alf:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  readln(st);
  n:=length(st);
  if n<26 then begin
                 writeln('-1');
                 halt;
               end;
  for i:=1 to 26 do
    begin
      p:=pos(st[i],alf);
      a[p]:=a[p]+1;
    end;

  kl:=0;
  for i:=1 to 26 do
    if a[i]>1 then begin
                     kl:=1;
                     break;
                   end;
  if kl=0 then
    begin
      for i:=1 to 26 do
        if a[i]=0 then begin
                       p:=pos('?',st);
                       st[p]:=alf[i];
                       a[i]:=a[i]+1;
                     end;
      for i:=1 to n do
        if st[i]<>'?' then write(st[i])
          else write('A');
      halt;
    end;

  for j:=2 to n-25 do
    begin
       p:=pos(st[j-1],alf);
       a[p]:=a[p]-1;
       p:=pos(st[j+25],alf);
       a[p]:=a[p]+1;

       kl:=0;
       for i:=1 to 26 do
         if a[i]>1 then begin
                          kl:=1;
                          break;
                        end;
       if kl=0 then
        begin
         for i:=1 to 26 do
           if a[i]=0 then begin
                            for q:=j to j+25 do
                            if st[q]='?' then begin
                                                st[q]:=alf[i];
                                                a[i]:=a[i]+1;
                                                break;
                                              end;
                          end;
         for i:=1 to n do
           if st[i]<>'?' then write(st[i])
             else write('A');
         halt;
        end;
    end;
  writeln('-1');
end.

var a:array['A'..'Z']of longint;
    n,i,l,r:longint;
    s,ans:ansistring;
    c:char;
    b:boolean;
procedure finish;
begin
     for i:=l to r do
         if s[i]='?'then
             for c:='A' to 'Z' do
                 if a[c]=0 then
                 begin
                      a[c]:=1;
                      s[i]:=c;
                      break;
                 end;
    for i:=1 to n do
    if s[i]='?' then s[i]:='A';
    writeln(s);
    halt;
end;
begin
     ans:='';
     readln(s);
     n:=length(s);
     for c:='A' to 'Z' do a[c]:=0;
     if n<26 then
     begin
          write(-1);
          halt;
     end;
     l:=1; r:=26;
     while r<=n do
     begin
          for c:='A' to 'Z' do a[c]:=0;
          b:=true;
          for i:=l to r do
          if s[i]<>'?' then
          begin
               inc(a[s[i]]);
               if a[s[i]]=2 then
               begin
                    l:=l+1;
                    r:=l+25;
                    b:=false;
                    break;
               end;
          end;
          if b then finish;
     end;
     write(-1);
end.

var
 s:ansistring;
 len,i:longint;
 flag:boolean;

procedure comp(x:longint);
const
 ch:array[1..26] of char=('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');
var
 num:array[1..26] of longint;
 numq,i,j:longint;
begin
 fillchar(num,sizeof(num),0);
 numq:=0;
 for i:=x to x+25 do
  if (s[i]>='A')and(s[i]<='Z') then inc(num[ord(s[i])-64]) else inc(numq);
 for i:=x to x+25 do
  if s[i]='?' then begin
   j:=1;
   while num[j]<>0 do inc(j);
   num[j]:=1;
   s[i]:=ch[j];
  end;
end;

procedure check(x:longint);
var
 num:array[1..26] of longint;
 i:longint;
begin
 fillchar(num,sizeof(num),0);
 for i:=x to x+25 do
  if (s[i]>='A')and(s[i]<='Z') then begin
  inc(num[ord(s[i])-64]);
  if num[ord(s[i])-64]>1 then begin flag:=false;exit;end;
 end;
 flag:=true;
end;

begin
 readln(s);
 len:=length(s);
 if len<26 then begin writeln('-1');exit;end;
 for i:=1 to len-25 do begin
    check(i);
	if flag then begin comp(i);break;end;
 end;
 //writeln(s);
// writeln(len);
 if flag then begin
  for i:=1 to len do
   if s[i]='?' then s[i]:='A';
  writeln(s);
  end else writeln('-1');
end.

label res;
var s:string; b:array[65..90] of integer; i,j,x:integer;
begin //A 65 Z 90
readln(s);
if length(s)<26 then begin writeln(-1); exit; end;
x:=-1;
res:
x:=x+1;
if x+26>length(s) then begin writeln(-1); exit; end;
for i:=65 to 90 do b[i]:=0;
for i:=1+x to 26+x do if s[i]<>'?' then if b[ord(s[i])]=0 then b[ord(s[i])]:=1
        else goto res;

for i:=1+x to 26+x do
        if s[i]='?' then
                for j:=65 to 90 do
                        if b[j]=0 then begin b[j]:=1; s[i]:=chr(j); break; end;
for i:=1 to length(s) do
        if s[i]='?' then s[i]:='A';
writeln(s);
end.

var
  s,s2:ansistring;
  len,i,j,z,p:longint;
  ch:char;
  bo:boolean;
  c:array[0..100]of char;
  b:array['?'..'Z']of boolean;
begin
  read(s);
  len:=length(s);
  bo:=true;
  for i:=1 to len-25 do
    begin
      fillchar(b,sizeof(b),false);
      p:=0;
      for j:=1 to 27 do
        begin
          if j=27 then break;
          if s[i+j-1]='?' then inc(p)
          else begin
          if b[s[i+j-1]] then break
          else b[s[i+j-1]]:=true;
          end;
        end;
      if j<27 then continue;
      z:=0;
      for ch:='A' to 'Z' do
        begin
          if not b[ch] then
          begin
            inc(z);
            c[z]:=ch;
          end;
        end;
      s2:=s;
      z:=0;
      for j:=1 to 26 do
        if s2[i+j-1]='?' then begin
          inc(z);
          s2[i+j-1]:=c[z];
          end;
      bo:=false;
      break;
    end;
  if bo then write(-1)
  else begin
         for i:=1 to len do
           begin
             if s2[i]='?' then write('A')
             else write(s2[i]);
           end;
       end;
end.

Var s:ansistring;
    i,j:longint; l,r,f:int64;
    a:array[65..90] of int64;
    Begin
      readln(s);
      l:=1;
      r:=26;
      f:=1;
      if length(s)<26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
      if s[i]<>'?' then a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then

       while (r+1<=length(s)) do
       begin
        f:=1;
        r:=r+1;
        l:=l+1;
        if s[l-1]<>'?' then a[ord(s[l-1])]:=a[ord(s[l-1])]-1;
        if s[r]<>'?' then a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      if f=0 then writeln(-1)
       else
        for i:=1 to length(s) do
         if (i>=l) and (i<=r) then begin
         if not(s[i]='?') then write(s[i])
         else
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end; end
             else if not(s[i]='?') then write(s[i]) else write('A');
      End.

const fi='b.inp';
      fo='b.out';
var s:ansistring;
    i,j:longint;
    d:array['A'..'Z']of longint;
    jj:char;
    ktt:boolean;
function kt:boolean;
var j:char;
    begin
        for j:='A' to 'Z' do
            if d[j]>1 then exit(false);
        exit(true);
    end;
begin
    //assign(input,fi);reset(input);
    //assign(output,fo);rewrite(output);
    ktt:=false;
    readln(s);
    for i:=1 to length(s) do
        begin
            if s[i]<>'?' then inc(d[s[i]]);
            if (i>26)and (s[i-26]<>'?') then dec(d[s[i-26]]);
            if i>=26 then
                begin
                    if kt=true then
                        begin
                        ktt:=true;
                        for j:=i-25 to i do
                            if s[j]='?' then
                                for jj:='A' to 'Z' do
                                    if d[jj]=0 then
                                    begin
                                        inc(d[jj]);
                                        s[j]:=jj;
                                        break;
                                    end;
                        break;
                        end;
                end;
        end;
    for i:=1 to length(s) do
        if s[i]='?' then s[i]:='A';
    if ktt=false then writeln(-1) else writeln(s);
end.

program cf716B;
var n,i,j:longint;
    s,s2:string;
    c:char;
    br:array['?'..'Z'] of longint;
    cont:boolean;
begin
readln(s);
n:=length(s);

for j:=1 to n-25 do
begin

for c:='A' to 'Z' do
        br[c]:=0;

for i:=j to j+25 do
        inc(br[s[i]]);

cont:=false;
for c:='A' to 'Z' do
        if br[c]>1 then
                begin
                cont:=true;
                break;
                end;

if cont then
        continue;

c:='A';

s2:=s;

for i:=j to j+25 do
        if s[i]<>'?' then
                //write(s[i])
                s2[i]:=s[i]
        else
                begin
                while br[c]=1 do
                        inc(c);
                br[c]:=1;
                //write(c);
                s2[i]:=c;
                end;

for i:=1 to j-1 do
        if s[i]='?' then
                s2[i]:='A'
        else
                s2[i]:=s[i];
for i:=j+26 to n do
        if s[i]='?' then
                s2[i]:='A'
        else
                s2[i]:=s[i];
writeln(s2);
exit;
end;
writeln('-1');
end.

label 1;
var s,s2:string;
    i,j,k,no,ko:longint;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);  }
read(s);
if length(s)<26 then
begin
write(-1);
halt;
end;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
i:=1;
1: while i<=length(s)-25 do
begin
for j:=i to 25+i do
begin
if s[j]<>'?' then
begin
if pos(s[j],s2)=0 then
begin
inc(i);
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
goto 1;
end;
delete(s2,pos(s[j],s2),1);
end;
end;
no:=i;
ko:=25+i;
break;
end;
if i>length(s)-25 then
begin
write(-1);
halt;
end;
{if s2='' then
begin
write(-1);
halt;
end;}
k:=1;
for i:=1 to length(s) do
begin
if (i<no) or (ko<i) then
if (s[i]='?') then
write('A')
else
write(s[i]);
if (i>=no) and (i<=ko) then
if s[i]='?' then
begin
write(s2[k]);
inc(k);
end
else write(s[i]);
end;
{close(input);
close(output);}
end.

var s:ansistring;
f,f1:array[1..26] of byte;
n,i,j,k,k1,fl,p:longint;
begin
readln(s);
n:=length(s);

for i:=1 to  n-25 do begin

 fillchar(f,sizeof(f),0);
 p:=1;

for  j:=i to i+25 do
if s[j]<>'?' then begin
 k:= ord(s[j])-64;
 inc(f[k]);
 if f[k]>1 then p:=0;
 end;

 if p=1 then begin

  k1:=0;
 for j:=1 to 26 do
 if f[j]=0 then begin inc(k1); f1[k1]:=j; end;

 for j:=i to i+25 do
 if s[j]='?' then begin s[j]:=chr(f1[k1]+64); dec(k1); end;

 fl:=1;
 break;
 end;

end;

if fl=0 then writeln(-1)
else begin

 for i:=1 to n do
 if s[i]='?' then write('A')
 else write(s[i]);
end;

end.

var s:ansistring;
    a:array[0..1000] of longint;
Procedure chuongtrinh;
var x:ansistring;
    i,j,dem:longint;
begin
read(s);
if length(S)<26 then
   begin
    write(-1);
    halt;
   end
else
 begin
for i:=1 to length(S)-25 do
  begin
   x:=copy(s,i,26);
   dem:=0;
for j:=1 to 26 do a[j]:=0;
  for j:=1 to 26 do
   if x[j]<>'?' then inc(a[ord(x[j])-64]);
for j:=1 to 26 do
if a[j]>1 then dem:=1;
if dem=0 then
   begin
     for j:=i to i+25 do
      if s[j]='?' then
       for dem:=1 to 26 do
        if a[dem]=0 then
          begin
           s[j]:=chr(dem+64);
           inc(a[dem]);
          break;
end;
break;
end;
if i=length(s)-25 then
   begin
     write(-1);
     halt;
   end;
end;
for i:=1 to length(S) do
if s[i]='?' then s[i]:='A';
write(s);
end;
end;
BEGIN
  chuongtrinh;
END.

Const Finp = '';
      Fout = '';
Var s:Ansistring;
    skip:Boolean;
Procedure Input;
Var f:Text;
Begin
    Assign(f,finp); Reset(f);
    Readln(f,s); Close(f);
End;
Function Check(pos:Longint):Boolean;
Var d:Array[1..26] of Boolean;
    i:Longint;
Begin
    Fillchar(d,sizeof(d),true);
    For i:=pos to pos+25 do
        If s[i] <> '?' then
        If d[ord(s[i])-64] then
            d[ord(s[i])-64]:=false
        Else exit(false);
    exit(true);
End;
Procedure Replace(posi:Longint);
Var k,i:Longint;
    st:String;
Begin
    st:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    For i:=posi to posi+25 do
        delete(st,pos(s[i],st),1);
    k:=1;
    For i:=posi to posi+25 do
        If s[i] = '?' then
            Begin
                s[i]:=st[k];
                inc(k);
            End;
End;
Procedure Solve;
Var i:Longint;
Begin
    skip:=True;
    If length(s) < 26 then exit;
    skip:=False;
    For i:=1 to length(s)-25 do
        If Check(i) then
            Begin
                Replace(i); Exit;
            End;
    skip:=true;
End;
Procedure Output;
Var f:Text;
    i:Longint;
Begin
    Assign(f,fout); Rewrite(f);
    If skip then write(f,-1) else
    For i:=1 to length(s) do
        If s[i] = '?' then write(f,'V') else write(f,s[i]);
    Close(f);
End;
Begin
    Input;
    Solve;
    Output;
End.

var n,m,i,j,k,ned:longint;
    f:array['A'..'Z']of longint;
    s:ansistring;
    c:char;
begin
readln(s);
if length(s)<26 then begin writeln(-1);halt;end;
for j:=1 to 26 do begin
  if s[j]<>'?' then inc(f[s[j]]) else inc(k);
end;
for i:=1 to length(s)-25 do begin
  if i>1 then begin
    if s[i-1]='?' then dec(k) else dec(f[s[i-1]]);
    if s[i+25]='?' then inc(k) else inc(f[s[i+25]]);
  end;
  ned:=0;
  for c:='A' to 'Z' do if f[c]=0 then inc(ned);
  if ned<=k then begin
    for j:=1 to (i-1) do begin
      if s[j]<>'?' then write(s[j]) else write('A');
    end;
    for j:=1 to 26 do begin
      if s[i+j-1]<>'?' then write(s[i+j-1]) else begin
        for c:='A' to 'Z' do if f[c]=0 then begin inc(f[c]);write(c);break;end;
      end;
    end;
    for j:=(i+26) to length(s) do begin
      if s[j]<>'?' then write(s[j]) else write('A');
    end;
    halt;
  end;
end;
writeln(-1);
end.

var i,j,k1,o,k,o1,l:longint;
niz:array[0..50] of longint;
a1:char;
a:ansistring;
begin
read (a);
o1:=0;
for i:=1 to length(a) do
begin
        if (a[i]='?') then k:=k+1

        else
        niz[ord(a[i])-64]:=niz[ord(a[i])-64]+1;

        if (i>=26) then
        begin
                o:=0;
                k1:=0;
                for j:=1 to 26 do
                begin
                        if niz[j]>1 then
                        begin
                                o:=1;
                                break;
                        end
                        else if niz[j]=0 then
                        begin
                                k1:=k1+1;
                        end;
                end;
                if (o=0) and (k1=k) then
                begin
                        l:=1;
                        for j:=i-26+1 to i do
                        begin
                                if a[j]='?' then
                                begin
                                        while (niz[l]>0) do
                                        begin
                                                l:=l+1;
                                        end;
                                        a1:=chr(l+64);
                                        delete (a,j,1);
                                        insert(a1,a,j);
                                        niz[l]:=1;
                                end;
                        end;
                        o1:=1;
                        break;
                end;
                if (a[i-26+1]='?') then
                k:=k-1
                else
                niz[ord(a[i-26+1])-64]:=niz[ord(a[i-26+1])-64]-1;
        end;
end;
if o1=0 then
writeln ('-1')
else
begin
        for i:=1 to length(a) do
        begin
                if a[i]='?' then
                begin

                          delete (a,i,1);
                          insert('A',a,i);
                end;
        end;

         write (a);
end;
end.

var
 i,j,k,n,t,l,l1,k1:longint;
c,i1,m: qword;
 flag,flag1:integer;
s,s1,alp:ansistring;

  x:array[1..2600000] of qword;

function proverka(s:ansistring):boolean;
var alp,s1:ansistring;
i,j,l,k1:longint;
x:array[1..260000]of integer;
flag,flag1:integer;
    begin
        l:=length(s);
         flag1:=0;
    for k1:=1 to l-25 do begin
        s1:=copy(s,k1,26);
        alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        i:=1;
            //s1:=copy(s,i,26);
            flag:=1;
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to 26 do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for j:=1 to 26 do
                if x[j]=0 then flag:=0;
            if flag=1 then begin
             //   writeln(s1);
                flag1:=1;
            end;
    end;
        proverka:=(flag1=1);
    end;
begin
  readln(s);
///  writeln(s);
l:=length(s);
if l<26 then writeln(-1)
 else begin
    alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    i:=1;
    flag1:=0;
//    while ((i<=l)and(flag1=0)) do begin
 //       s1:=copy(s,i,26);
//        flag:=1;
//        for j:=1 to 26 do
 //           x[j]:=0;
 //       for j:=1 to 26 do begin
 //           if (s1[j]=alp[j])then x[j]:=1;
//        end;
 //       for j:=1 to 26 do
 //           if x[j]=0 then flag:=0;
//        if flag=1 then flag1:=1
//        else i:=i+1;
//    end;
//    if flag1=1 then begin
 //       while (pos('?',s)<>0) do  begin
//            i:=pos('?',s);
//            delete(s,i,1);
//            insert('A',s,i);
//        end;
//    end
 //   else begin //надо вставлять
     //   writeln(s);
    for k1:=1 to l-25 do begin
        s1:=copy(s,k1,26);
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to 26 do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for i:=1 to 26 do begin
                if (s1[i]='?') then begin
                    flag1:=0;
                    j:=1;
                    while ((j<=26)and(flag1=0)) do begin
                        if x[j]=0 then begin
                            s1[i]:=alp[j];
                            x[j]:=1;
                            flag1:=1;
                        end
                        else j:=j+1;
                    end;
                end;
            end;
        if proverka(s1) then begin
                while (pos('?',s1)<>0) do  begin
                    i:=pos('?',s1);
                    delete(s1,i,1);
                    insert('A',s1,i);
                end;
                delete(s,k1,26);
                insert(s1,s,k1);
                while (pos('?',s)<>0) do  begin
                        i:=pos('?',s);
                        delete(s,i,1);
                        insert('A',s,i);
                end;
        end;
     //   writeln(s1);
    end;
//writeln(s);
   if (proverka(s)) then
   writeln(s)
    else writeln(-1);
end;

end.

var
    s : ansistring;
    n, i, j : longint;
    has : array['A'..'Z'] of boolean;
    ok, flg : boolean;
    c : char;

begin
    readln(s);
    n := length(s);
    if (n < 26) then
    begin
        writeln(-1);
        exit;
    end;
    for i := 1 to n - 26 + 1 do
    begin
        fillchar(has, sizeof(has), false);
        ok := true; flg := false;
        for j := i to i + 25 do
        if (s[j] <> '?') then
        begin
            if (has[s[j]]) then
            begin
                ok := false;
                break;
            end
            else has[s[j]] := true;
        end
        else flg := true;
        if (ok) then
        begin
            if (flg) then
            begin
                for j := i to i + 25 do
                begin
                    if (s[j] = '?') then
                    begin
                        for c := 'A' to 'Z' do
                        begin
                            if not (has[c]) then
                            begin
                                has[c] := true;
                                s := copy(s, 1, j - 1) + c + copy(s, j + 1, n - j);
                                break;
                            end;
                        end;
                    end;
                end;
            end;
            for j := 1 to n do
            if (s[j] = '?') then s := copy(s, 1, j - 1) + 'A' + copy(s, j + 1, n - j);
            writeln(s);
            exit;
        end;
    end;
    writeln(-1);
end.

uses math;
var   s:ansistring;
     i,j,k,p,n:longint;
     a:array[-1000..10000] of longint;
begin
 readln(s);

 n:=length(s);

 for i:=1 to n-25 do
  begin
  for j:=1 to 26 do
   a[j]:=0;
   p:=0;
   for j:=i to i+25 do
   if (a[ord(s[j])-64]=1) and (s[j]<>'?') then p:=1 else
   if s[j]<>'?' then inc(a[ord(s[j])-64]);

   if p=0 then
    begin
     for j:=i to i+25 do
     if s[j]='?' then
      begin
       for k:=1 to 26 do
       if a[k]=0 then
        begin
        s[j]:=chr(k+64);
        inc(a[k]);
        break;
       end;
     end;
     for j:=1 to n do
     if (s[j]='?') then s[j]:='A';
    writeln(s);
   exit;
  end;
 end;
writeln(-1);
end.

var
   a:array ['A'..'Z'] of longint;
   s:string;
   top,i,n,h:longint;
procedure tx(i,j:longint);
   var
      f:longint;
      c:char;
   begin
   for f:=i to j do
      if s[f]='?' then
         begin
         for c:='A' to 'Z' do
            if a[c]=0 then
               begin
               delete(s,f,1);
               insert(c,s,f);
               inc(a[c]);
               break;
               end;
         end;
   for f:=1 to n do
      if s[f]='?' then
         begin
         delete(s,f,1);
         insert('A',s,f);
         end;
   h:=1;
   end;
begin
readln(s);
if length(s)<26 then writeln('-1')
else
begin
n:=length(s);
for i:=1 to 26 do
   if s[i]<>'?' then
      begin
      if a[s[i]]=1 then inc(top);
      inc(a[s[i]]);
      end;
if top=0 then tx(1,26)
else
begin
for i:=2 to length(s)-25 do
if s[i-1]<>'?' then
   begin
   if a[s[i-1]]=2 then dec(top);
   dec(a[s[i-1]]);
   if s[i+25]<>'?' then
      begin
      if a[s[i+25]]=1 then inc(top);
      inc(a[s[i+25]]);
      end;
   if top=0 then
      begin
      tx(i,i+25);
      break;
      end;
   end
else
   begin
   if s[i+25]<>'?' then
      begin
      if a[s[i+25]]=1 then inc(top);
      inc(a[s[i+25]]);
      end;
   if top=0 then
      begin
      tx(i,i+25);
      break;
      end;
   end;
end;
if h=1 then
   writeln(s)
else
   writeln('-1');
end;
end.

const
  fi='';
var
  res,st:ansistring;
  a:array[0..50000,0..27] of longint;
  chuaxet:array[0..27] of boolean;
  ok:boolean;
  f:Text;
  j,n,i,tg:longint;
begin
  assign(f,fi); reset(f);
  readln(f,st);
  n:=length(st);
  if n<26 then
    begin
      writeln(-1); exit;
    end;
  for i:=1 to n do
    if st[i]<>'?' then
    begin
      tg:=ord(st[i])-65+1;
      inc(a[i,tg]);
    end;
  res:=st;
  for i:=1 to n do
    for j:=1 to 26 do a[i,j]:=a[i,j]+a[i-1,j];
  for i:=1 to n-26+1 do
    begin
      fillchar(chuaxet,sizeof(chuaxet),true);
      ok:=true;
      for j:=1 to 26 do
        if a[i+26-1,j]-a[i-1,j]>=2 then
          begin
            ok:=false;
          end
          else if a[i+26-1,j]-a[i-1,j]=1 then chuaxet[j]:=false;
        if ok then
          begin
            tg:=1;
            for j:=i to i+26-1 do
              if st[j]<>'?' then res[j]:=st[j]
              else
                begin
                  while (tg<=26) and (not chuaxet[tg]) do inc(tg);
                  res[j]:=char(tg+65-1);
                  inc(tg);
                end;
            for j:=1 to n do
              if res[j]='?' then res[j]:='A';
            writeln(Res);
            readln;
            exit;
          end;
    end;
  writeln(-1);
  readln;
end.

var
 s:ansistring;
 a:array[65..90]of longint;
 n,k,i,l,r,p,j:longint;

procedure ans(s:ansistring);
begin
 writeln(s);
 halt;
end;

function check:boolean;
var
 i,k1:longint;
begin
 k1:=0;
 for i:=65 to 90 do if a[i]>1 then exit(false) else if a[i]=1 then inc(k1);
 if k1+k=26 then exit(true) else exit(false);
end;

begin
 readln(s);
 if length(s)<26 then ans('-1');
 for i:=1 to 26 do if s[i]<>'?' then inc(a[ord(s[i])]) else inc(k);
 l:=1;
 r:=26;

 if check then
 begin
  p:=64;
  for i:=1 to length(s) do if s[i]='?' then
  begin
   if (i<l)or(i>r) then s[i]:='A' else
   begin
    for j:=p+1 to 90 do if a[j]=0 then
    begin
     s[i]:=chr(j);
     p:=j;
     break;
    end;
   end;
  end;
  ans(s);
 end else if length(s)=26 then ans('-1');

 repeat
  inc(r);
  if s[r]<>'?' then inc(a[ord(s[r])]) else inc(k);
  if s[l]<>'?' then dec(a[ord(s[l])]) else dec(k);
  inc(l);
  if check then
  begin
   p:=64;
   for i:=1 to length(s) do if s[i]='?' then
   begin
    if (i<l)or(i>r) then s[i]:='A' else
    begin
     for j:=p+1 to 90 do if a[j]=0 then
     begin
      s[i]:=chr(j);
      p:=j;
      break;
     end;
    end;
   end;
   ans(s);
  end;
 until r=length(s);
 ans('-1');
end.

var s:ansistring;
    i,j,k,dem,sl:longint;
    kt:array[0..1000000] of longint;
procedure nhap;
    begin
        readln(s);
    end;

procedure xuli;
    begin
        For i:=1 to length(s)-26+1 do
            begin
                For j:=i to i+26-1 do
                    begin
                        if (kt[ord(s[j])]=0) and (s[j]<>'?') then
                            begin
                                inc(dem);
                                kt[ord(s[j])]:=1;
                            end;
                        if s[j]='?' then inc(sl);
                    end;
                if dem+sl=26 then
                    begin
                        For j:=i to 26-1+i do
                            if s[j]='?' then
                                begin
                                    For k:=65 to 90 do
                                        if kt[k]=0 then
                                            begin
                                                s[j]:=chr(k);
                                                kt[k]:=1;
                                                break;
                                            end;
                                end;
                        For j:=1 to length(s) do
                            if s[j]='?' then write('A') else write(s[j]);
                        halt;
                    end;
                For j:=i to i+26-1 do
                    kt[ord(s[j])]:=0;
                dem:=0;
                sl:=0;
            end;
        writeln(-1);
    end;

begin
nhap;
xuli;
end.

  var
      s:ansistring;

        b,c:array[1..100000] of longint;

          i,j,countz,countt,countv,f,vern,fv:longint;
    begin
      readln(s);

         vern:=0;

           fv:=0;

        for i:=1 to length(s)-26+1 do begin

          for j:=1 to 26 do begin c[j]:=0; b[j]:=0; end;

            for j:=i to i+25 do
              if s[j]<>'?' then inc(b[ord(s[j])-64]);

              countz:=0;
                for j:=1 to 26 do if b[j]=0 then begin inc(countz); c[countz]:=j; end;

              countv:=0;
                for j:=i to i+25 do if s[j]='?' then inc(countv);

              countt:=0;

                for j:=1 to 26 do if b[j]>1 then inc(countt);

                if countt=0 then begin

                      inc(vern);

                      f:=0;

                     for j:=i to i+25 do begin
                       if s[j]='?' then begin inc(f); s[j]:=chr(64+c[f]); end;

                  end;
                      break;
                end;
              end;
                for i:=1 to length(s) do if s[i]='?' then s[i]:='A';
              if vern=0 then write(-1) else
              write(s);
            end.

var alf,st:ansistring;
l,i,j,kol,p,q,kl:longint;
a:array[0..100] of longint;
begin
  alf:='QWERTYUIOPASDFGHJKLZXCVBNM';
  readln(st);
  l:=length(st);
  if l<26 then begin
                 writeln(-1);
                 halt;
               end;
  for q:=1 to l-26+1 do
BEGIN
  for i:=1 to 26 do
    a[i]:=0;
  kl:=0;
  for i:=q to q+25 do
    if st[i]<>'?' then begin
                         p:=0;
                         p:=pos(st[i],alf);
                         if a[p]=1 then kl:=1
                                   else if a[p]=0 then a[p]:=1;
                       end
                  else kol:=kol+1;

  if kl<>1 then begin
                  for i:=q to q+25 do
                    if st[i]='?' then begin
                                        for j:=1 to 26 do
                                          if a[j]=0 then begin
                                                           a[j]:=1;
                                                           break;
                                                         end;
                                        st[i]:=alf[j];
                                      end;
                  kl:=10;
                end;
  if kl=10 then begin
                  for i:=1 to l do
                    if st[i]='?' then st[i]:='A';
                  writeln(st);
                  halt;
                end;
END;
  writeln(-1);
end.

var s,t,r:ansistring;n,i,j,k:longint;a:array['A'..'Z']of longint;chk:boolean;
begin
        readln(s);t:='';chk:=false;k:=0;if length(s)>=26 then
        begin
                for i:=1 to length(s)-26+1 do
                begin
                        chk:=true;fillchar(a,sizeof(a),0);
                        for j:=i to i+25 do if s[j]<>'?' then
                        begin
                                if a[s[j]]=0 then a[s[j]]:=1 else
                                begin
                                        chk:=false;break;
                                end;
                        end;if chk then
                        begin
                                for j:=1 to 26 do
                                if a[chr(j+64)]=0 then t:=t+chr(j+64);
                                k:=i;
                        end;if chk then break;
                end;
        end;if chk then
        begin
                j:=k;for i:=1 to length(t)do
                begin
                        while (s[j]<>'?')and(j<k+25) do inc(j);
                        s[j]:=t[i];
                end;j:=1;while j<=length(s) do
                begin
                        if s[j]='?' then s[j]:='A';inc(j);
                end;writeln(s);
        end else writeln(-1);readln;
end.

var
    s: ansistring;
    i, j, n, chamhoi, top: longint;
    b: array[0..500000] of char;
    a: array['A'..'Z'] of longint;
    c: char;
    nice: boolean;

begin
    //assign(input, 'b.inp'); reset(input);
    //assign(output, 'b.out'); rewrite(output);

    readln(s);
    if (length(s) <= 25) then
        begin
            writeln(-1);
            halt;
        end
    else
        begin
            for i:= 1 to length(s) - 25 do
                begin
                    nice:= true; top:= 0; chamhoi:= 0;
                    fillchar(a, sizeof(a), 0);
                    for j:= i to i + 25 do
                        if (s[j] = '?') then inc(chamhoi)
                    else
                        inc(a[s[j]]);
                    for c:= 'A' to 'Z' do
                        begin
                            if (a[c] = 0) then
                                begin
                                    inc(top);
                                    b[top]:= c;
                                end;
                            if (a[c] > 1) then nice:= false;
                        end;
                    if not(nice) then continue;
                    if (chamhoi - top <> 0) then continue;
                    for j:= i to i + 25 do
                        if (s[j] = '?') then
                            begin
                                s[j]:= b[top];
                                dec(top);
                            end;
                    for j:= 1 to length(s) do
                        if (s[j] = '?') then s[j]:= 'A';
                    writeln(s);
                    halt;
                end;
        end;
    writeln(-1);
    //close(input); close(output);
end.

var a:array['A'..'Z']of longint;
n,i,l,r:longint;
s,ans:ansistring;
c:char;
b:boolean;

procedure finish;
begin
for i:=l to r do
if s[i]='?'then
for c:='A' to 'Z' do
if a[c]=0 then begin a[c]:=1; s[i]:=c; break; end;
for i:=1 to n do
if s[i]='?' then s[i]:='A';
writeln(s);
halt;
end;

begin
ans:='';
readln(s);
n:=length(s);
for c:='A' to 'Z' do a[c]:=0;
if n<26 then
begin
write(-1);
halt;
end;
l:=1;
r:=26;
while r<=n do
begin
for c:='A' to 'Z' do a[c]:=0;
b:=true;
for i:=l to r do
if s[i]<>'?' then
begin
inc(a[s[i]]);
if a[s[i]]=2 then begin l:=l+1; r:=l+25; b:=false; break; end;
end;
if b then finish;
end;
write(-1);
end.

const
    fin='';fon='';
var
    d:array ['A'..'Z'] of longint;
    s:ansistring;
    n:longint;
procedure nhap;
    begin
        assign(input,fin);reset(input);
        assigN(output,fon);rewrite(output);
        readln(s);
        n:=length(s);
    end;
function check(vitri:longint):boolean;
    var
        i,SoTu,SoKiTu:longint;
        c:char;
    begin
        for c:='A' to 'Z' do d[c]:=0;
        SoTu:=0;
        SoKiTu:=0;
        for i:=vitri to vitri+26-1 do
            begin
                if s[i]='?' then inc(SoKiTu)
                else
                    begin
                        if d[s[i]]=1 then exit(false);
                        inc(d[s[i]]);
                        inc(SoTu);
                    end;
            end;
        if SoKiTu=26-SoTu then exit(true)
        else exit(false);
    end;
procedure solve;
    var
        i,j:longint;
        c:char;
    begin
        for i:=1 to n-26+1 do
            begin
                if Check(i)=true then
                    begin
                        for j:=1 to i-1 do
                            begin
                                if s[j]<>'?' then write(s[j])
                                else write('A');
                            end;
                        for j:=i to i+26-1 do
                            begin
                                if s[j]<>'?' then write(s[j])
                                else
                                begin
                                    for c:='A' to 'Z' do
                                        begin
                                            if d[c]=0 then
                                                begin
                                                    write(c);
                                                    d[c]:=1;
                                                    break;
                                                end;
                                        end;
                                end;
                            end;
                        for j:=i+26 to n do
                            begin
                                if s[j]<>'?' then write(s[j])
                                else write('A');
                            end;
                        exit;
                    end;
            end;
        writeln(-1);
    close(input); close(output);
    end;
begin
    nhap;
    solve;
end.

const
   inp = 'input.txt';
   out = 'output.txt';
   maxn = 50000 + 5;

var
   n : longint;
   a, b : array[0..maxn] of longint;
   mark : array[0..26] of boolean;

procedure   init;
   var      i : longint;
            x : char;
   begin
      n := 0;
      while (not seekeof) do
         begin
            inc(n);
            read(x);
            if (x = '?') then a[n] := 0
            else a[n] := ord(x) - ord('A') + 1;
         end;
   end;

procedure   solve;
   var      i, j, m : longint;
            check : boolean;
   begin
      check := false;
      for i := 1 to n - 25 do
         begin
            for j := 1 to 26 do mark[j] := false;
            check := true;

            for j := i to i + 25 do
               if (a[j] > 0) then
                  if (mark[a[j]] = true) then
                     begin
                        check := false;
                        break;
                     end
                  else mark[a[j]] := true;

            if check = true then
               begin
                  m := 0;
                  for j := 1 to 26 do
                     if mark[j] = false then
                        begin
                           inc(m);
                           b[m] := j;
                        end;

                  m := 0;

                  for j := 1 to i - 1 do
                     if a[j] = 0 then write('A')
                     else write(chr(a[j] -1 + ord('A')));

                  for j := i to i + 25 do
                     if a[j] > 0 then write(chr(a[j] - 1 + ord('A')))
                     else
                        begin
                           inc(m);
                           write(chr(b[m] - 1 + ord('A')));
                        end;

                  for j := i + 26 to n do
                     if a[j] = 0 then write('A')
                     else write(chr(a[j] - 1 + ord('A')));

                  exit;
               end;
         end;
      if not check then writeln(-1);
   end;

begin
   //assign(input, inp); reset(input);
   //assign(output, out); rewrite(output);
   init;
   solve;
end.

var s:ansistring;
    i,j,k,dem,sl:longint;
    kt:array[0..1000000] of longint;
procedure nhap;
    begin
        readln(s);
    end;

procedure xuli;
    begin
        For i:=1 to length(s)-26+1 do
            begin
                For j:=i to i+26-1 do
                    begin
                        if (kt[ord(s[j])]=0) and (s[j]<>'?') then
                            begin
                                inc(dem);
                                kt[ord(s[j])]:=1;
                            end;
                        if s[j]='?' then inc(sl);
                    end;
                if dem+sl=26 then
                    begin
                        For j:=i to 26-1+i do
                            if s[j]='?' then
                                begin
                                    For k:=65 to 90 do
                                        if kt[k]=0 then
                                            begin
                                                s[j]:=chr(k);
                                                kt[k]:=1;
                                                break;
                                            end;
                                end;
                        For j:=1 to length(s) do
                            if s[j]='?' then write('A') else write(s[j]);
                        halt;
                    end;
                For j:=i to i+26-1 do
                    kt[ord(s[j])]:=0;
                dem:=0;
                sl:=0;
            end;
        writeln(-1);
    end;

begin
//assign(input,'372B.inp');reset(input);
//assign(output,'372B.out');rewrite(output);
nhap;
xuli;
end.

var st:ansistring;
    ch:array[0..50050] of char;
    i,j,n:longint;
    c:char;
    flag:boolean;
    used:array['A'..'Z'] of boolean;
begin
  readln(st); n:=length(st); for i:=1 to n do ch[i]:=st[i];
  for i:=1 to n-25 do begin
    fillchar(used,sizeof(used),false); flag:=true;
    for j:=i to i+25 do begin
      if ch[j]='?' then continue;
      if used[ch[j]] then begin flag:=false; break; end;
      used[ch[j]]:=true;
    end;
    if flag then begin
      for j:=i to i+25 do begin
        if ch[j]<>'?' then continue;
        for c:='A' to 'Z' do
          if not used[c] then begin
            ch[j]:=c; used[c]:=true; break;
          end;
      end;
      for j:=1 to n do
        if ch[j]='?' then ch[j]:='A';
      for j:=1 to n do write(ch[j]); writeln;
      break;
    end;
  end;
  if not flag then writeln(-1);
end.

var
s,s1:ansistring;
a:array[1..26] of longint;
i,j,q:longint;
begin
readln(S);
if length(S)<26
then begin
writeln(-1);
halt;
end;
//s:='ABC??FGHIJK???OPQR?TUVWXY?';

for i:=1 to length(S)-25 do begin
s1:=copy(s,i,26);
q:=0;
for j:=1 to 26 do
a[j]:=0;
for j:=1 to 26 do
if s1[j]<>'?'
then
inc(a[ord(s1[j])-64]);
for j:=1 to 26 do
if a[j]>1
then q:=1;
if q=0
then begin
for j:=i to i+25 do
if s[j]='?'
then for q:=1 to 26 do
if a[q]=0
then begin
s[j]:=chr(q+64);
inc(a[q]);
break;
end;
break;
end;
if i=length(s)-25
then begin writeln(-1);  halt;end;
end;
for i:=1 to length(S) do
if s[i]='?'
then s[i]:='A';
writeln(S);
end.

var i,j,n,count,cc,h,wt:longint;s:ansistring;
    used:array['A'..'Z']of longint;
procedure print(t:longint);
var i:longint;j:char;
begin
        for i:=1 to t-1 do
            if s[i]<>'?' then write(s[i]) else write('A');
        for i:=t to t+26-1 do
        begin
             if s[i]<>'?' then write(s[i])
             else
                for j:='A' to 'Z' do
                    if used[j]<>count then begin used[j]:=count;write(j);break;end;
        end;
        for i:=t+26 to n do
            if s[i]<>'?' then write(s[i]) else write('A');
        wt:=1;
end;
begin
        //assign(input,'716B.inp');reset(input);
        //assign(output,'716B.out');rewrite(output);
        readln(s);
        n:=length(s);
        for i:=1 to n-26+1 do
        begin
                inc(count);h:=0;cc:=0;
                for j:=i to i+26-1 do
                    if(s[j]='?')then inc(h)
                    else if used[s[j]]<>count then
                    begin
                        used[s[j]]:=count;
                        inc(cc);
                    end;
                if cc+h=26 then begin print(i);break;end;
        end;
        if wt=0 then writeln(-1);
        close(input);close(output);
end.

var n1,n:ansistring;
    i,k,q,d:integer;
    j:char;
    f:boolean;
begin
        read(n);
f:=false; q:=1; i:=q;
while (i<=length(n)-25) and (f=false) do
   begin
     n1:='';
     for d:=i to i+25 do
       n1:=n1+n[d];
     k:=0;
     for j:='A' to 'Z' do
       begin
         if (pos(j,n1)<>0) then
            begin
                inc(i);
                inc(k);
            end else
         if (pos(j,n1)=0) and (pos('?',n1)<>0) then
            begin
               insert(j,n1,pos('?',n1));
               delete(n1,pos('?',n1),1);
               inc(k);
               inc(i);
            end else break;
       end;
     if k=26 then f:=true else
        begin
          inc(q);
          i:=q;
        end;
   end;
if f=true then
   begin
      insert(n1,n,i);
      delete(n,q,26);
      for i:=1 to length(n) do
         if n[i]='?' then write('A') else write(n[i]);
   end else write(-1);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var i, j, jj, n, k, q : longint;
    alf :array['A'..'Z']of longint;
    kol, cur : longint;
    s : string;

function check(num : longint) : boolean;
var q, kk : longint;
    c : char;
begin
  kk := 0;
  for c := 'A' to 'Z' do
    if alf[c] > 1 then
      begin
        check := False;
        exit;
      end
    else
      if alf[c] = 0 then
        inc(kk);

  if kk > cur then
    check := False
  else
    check := True;
end;

procedure make(num : longint);
var i : longint;
    c, t : char;
begin

  for i := 1 to num-1 do
    if s[i] = '?' then
      s[i] := 'A';

  for i := num+26 to n do
    if s[i] = '?' then
      s[i] := 'A';

  for i := num to num+25 do
    if s[i] = '?' then
      begin
        for t := 'A' to 'Z' do
          if alf[t] = 0 then
            begin
              alf[t] := 1;
              s[i] := t;
              break;
            end;
      end;
end;

begin
//  assign(input, 'input.txt'); assign(output, 'output.txt');

  readln(s);
  n := length(s);

  if n < 26 then
    begin
      writeln(-1);
      exit;
    end;

  cur := 0;
  for i := 1 to 26 do
    if s[i] = '?' then
      inc(cur)
    else
      inc(alf[s[i]]);

  if check(1) then
    begin
      make(1);
      writeln(s);
      exit;
    end;

  for i := 27 to n do
  begin
    if s[i-26] <> '?' then
      dec(alf[s[i-26]])
    else
      dec(cur);
    if s[i] = '?' then
      inc(cur)
    else
      inc(alf[s[i]]);

    if check(i-26+1) then
      begin
        make(i-26+1);
        writeln(s);
        exit;
      end;
  end;

  writeln(-1);
end.

function nice(var s:string):boolean;
  var i,sum,temp:integer;
      r:boolean;
      x:char;
      ans:string;
      a:array['A'..'Z'] of integer;
begin
    temp:=0;
    ans:=s;
    sum:=0;
    for x:='A' to 'Z' do a[x]:=0;
    for i:=1 to length(S) do
    if (s[i]='?') then temp:=temp+1 else a[s[i]]:=1;
    for x:='A' to 'Z' do sum:=sum+a[x];
    if (sum+temp<26) then nice:=false else begin
       for x:='A' to 'Z' do begin
            if ((a[x]=0) and (temp>0)) then begin
                insert(x,ans,pos('?',ans));
                delete(ans,pos('?',ans),1);
            end;
       end;
       s:=ans;
       nice:=true;
    end;

end;
var m,t:string;
    i:integer;
    ans:boolean;
begin
    readln(m);
    ans:=false;
    t:='';
    if (length(m)<26) then write(-1) else begin
    for i:=1 to length(m)-25 do begin
      t:=copy(m,i,26);
      if nice(t) then begin
      ans:=true;
      delete(m,i,26);
      insert(t,m,i);
      break;
      end;
    end;
    if not ans then write(-1) ELSE begin
     for i:=1 to length(m) do if m[i]='?' then m[i]:='A';
     writeln(m);
     end;;
    end;
end.

var q:array[63..90] of byte;
    s:ansistring;
    i,j,a:longint;
function ans(a:longint):ansistring;
 var w:string;
     z:longint;
     an:ansistring;
 begin
  w:='';
  an:='';
  fillchar(q,sizeof(q),0);
  for j:=a to a+25 do
   if s[j]<>'?'
    then q[ord(s[j])]:=1;
  for j:=65 to 90 do
   if q[j]=0
    then w:=w+chr(j);
  z:=length(w);
  for j:=1 to a-1 do
   if s[j]='?'
    then an:=an+'A'
    else an:=an+s[j];
  for j:=a to a+25 do
   if s[j]='?'
    then begin
          an:=an+w[z];
          dec(z);
         end
    else an:=an+s[j];
  for j:=a+26 to length(s) do
   if s[j]='?'
    then an:=an+'A'
    else an:=an+s[j];
  ans:=an;
 end;
begin
 read(s);
 if length(s)<26
  then write('-1')
  else begin
        for i:=1 to length(s)-25 do
         begin
          fillchar(q,sizeof(q),0);
          a:=0;
          for j:=0 to 25 do
           begin
            inc(q[ord(s[j+i])]);
            if (s[j+i]<>'?') and (q[ord(s[j+i])]>1)
             then a:=1;
           end;
          if a=0
           then begin
                 write(ans(i));
                 halt;
                end;
         end;
        write('-1');
       end;
end.

var a,s,d,f,g,h,j,k,l,i,ii:longint;
z,x:array['A'..'Z']of boolean;
c:ansistring;
begin
readln(c);
i:=1;

while i<=length(c)do
begin
h:=i;
l:=0;
k:=0;
z:=x;
j:=65;
if true then
begin
while (l<>1)and(i<=length(c))and(k<>26) do
begin
if (c[i]<>'?')and(z[c[i]]) then l:=1;
if (c[i]<>'?')and(not z[c[i]]) then
begin
z[c[i]]:=true;
inc(k);
end;
if c[i]='?' then
inc(k);
inc(i);
end;

if k=26 then
begin
for ii:=i-26 to i-1 do
if c[ii]='?' then
begin
while z[chr(j)]=true do
inc(j);
c[ii]:=chr(j);
inc(j);
end;
for ii:=1 to length(c)do
if c[ii]='?' then
c[ii]:='A';
writeln(c);
halt;
end;
end;

i:=h+1;
end;

writeln(-1);
end.

const fi = '';
      fo = '';
var a: array['A'..'Z'] of boolean;
    b: array[1..100000] of longint;
    i, j, x, m: longint;
    s: ansistring;
    c: char;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);

  readln(s);
  for i:=1 to length(s)-25 do
    begin
      x:=0;
      fillchar(a,sizeof(a),false);
      fillchar(b,sizeof(b),0);
      for j:=i to i+25 do
        if s[j] = '?' then
          begin
            inc(x);
            b[x]:=j;
          end
        else a[s[j]]:=true;
      m:=0;
      for c:='A' to 'Z' do if a[c] = false then inc(m);
      if m > x then continue;
      m:=0;
      for c:='A' to 'Z' do if a[c] = false then
        begin
          inc(m);
          s[b[m]]:=c;
        end;
      for j:=1 to length(s) do if s[j] = '?' then s[j]:='A';
      writeln(s);
      halt;
    end;
  writeln(-1);

  close(input); close(output);
end.

var
  s,s2:string;
  len,i,j,z,p:longint;
  ch:char;
  bo:boolean;
  c:array[0..100]of char;
  b:array['?'..'Z']of boolean;
begin
  read(s);
  len:=length(s);
  bo:=true;
  for i:=1 to len-25 do
    begin
      fillchar(b,sizeof(b),false);
      p:=0;
      for j:=1 to 27 do
        begin
          if j=27 then break;
          if s[i+j-1]='?' then inc(p)
          else begin
          if b[s[i+j-1]] then break
          else b[s[i+j-1]]:=true;
          end;
        end;
      if j<27 then continue;
      z:=0;
      for ch:='A' to 'Z' do
        begin
          if not b[ch] then
          begin
            inc(z);
            c[z]:=ch;
          end;
        end;
      s2:=s;
      z:=0;
      for j:=1 to 26 do
        if s2[i+j-1]='?' then begin
          inc(z);
          s2[i+j-1]:=c[z];
          end;
      bo:=false;
      break;
    end;
  if bo then write(-1)
  else begin
         for i:=1 to len do
           begin
             if s2[i]='?' then write('A')
             else write(s2[i]);
           end;
       end;
end.

Program B;
CONST FINP = '1.INP';	FOUT = '1.OUT';
VAR fi, fo: text;
s: ansistring;
n: longint;
d: array[0..60000, '?'..'Z'] of longint;

Function f(l, r: longint; c:char):longint;
BEGIN
exit(d[r][c] - d[l-1][c]);
END;

Function check(i: longint): boolean;
Var cnt, tmp: longint;
c: char;
BEGIN
cnt := 0;
for c := 'A' to 'Z' do
	begin
	tmp := f(i, i+25, c);
	if tmp > 1 then exit(false);
	cnt := cnt + tmp;
	end;
if 26-cnt = f(i, i+25, '?') then exit(true);
exit(false);
END;

Procedure g(i: longint);
Var j, j1: longint;
t: ansistring;
c: char;
BEGIN
j1 := 1;
t := '';
for c := 'A' to 'Z' do if f(i, i+25, c) = 0 then t := t + c;
for j := i to i+25 do if s[j] = '?' then
	begin
	s[j] := t[j1];
	inc(j1);
	end;
for j := 1 to n do if s[j] = '?' then s[j] := 'K';
END;

Procedure Process;
Var i, j: longint;
c: char;
BEGIN
readln(fi, s);
n := length(s);
if (n < 26) then
	begin
	writeln(fo, -1);
	exit;
	end;
for i:=1 to n do
	for c := '?' to 'Z' do
		if s[i] = c then d[i][c] := d[i-1][c] + 1
			else d[i][c] := d[i-1][c];
for i:=1 to n-25 do if check(i) then
	begin
	g(i);
	writeln(fo, s);
	exit;
	end;
writeln(fo, -1);
END;

BEGIN
{$IFDEF ONLINE_JUDGE}
assign(fi, '');		assign(fo, '');
{$ELSE}
assign(fi, FINP);	assign(fo, FOUT);
{$ENDIF}
reset(fi);			rewrite(fo);
Process;
close(fi);
close(fo);
END.

var possible:boolean;
	st:string;
	sum:int64;
	i,j,k:int32;
	count:array[0..30] of int64;
Begin
	Read(st);
	possible:=False;
	If (length(st)>=26) then
		Begin
			For i:=1 to length(st)-26+1 do
				Begin
					sum:=0;
					Fillchar(count,sizeof(count),0);
					For j:=i to i+25 do
						Inc(count[Ord(st[j])-Ord('?')]);
					For j:=1 to Ord('Z')-Ord('?') do
						If (count[j]>0) then inc(sum);
					If (count[0]>=26-sum) then
						Begin
							possible:=True;
							For j:=i to i+25 do
								For k:=2 to Ord('Z')-Ord('?') do
									If (st[j]='?') and (count[k]=0) then
										Begin
											inc(count[k]);
											st[j]:=Chr(k+Ord('?'));
										End;
						End;
				End;
		End;
	For i:=1 to length(st) do if (st[i]='?') then st[i]:='A';
	If possible then Writeln(st)
	Else Writeln('-1');
End.

var b,m,n,i,c,a,j:longint;x,y:array['?'..'Z']of longint;f:boolean;
q:char;s:string;
begin
 reADln(s);
  n:=length(s);s:=s+'L';
  if N<26 then begin write(-1);halt;end;
  for j:=0 to 25 do inc(x[s[1+j]]);
 for i:=1 to n-25 do
 begin

 f:=true;
 for q:='A' to 'Z' do
 if x[q]>1 then begin f:=false;break; end;
  if f then
  begin
   q:='A';
   for j:=0 to 25 do
   if s[j+i]='?' then begin
    while x[q]=1 do inc(q);
    s[j+i]:=q;x[q]:=1;
    end;
    for j:=1 to n do
    if s[j]='?' then write('H') else write(s[j]);halt;
   end;
   dec(x[s[i]]);inc(x[s[i+26]]);

end;
write(-1);
end.

var
 a:array['A'..'Z']of longint;
 s,w:ansistring;
 c:char;
 n,m,i,k,j,f,t,x,y,z,q:longint;
begin
 readln(s);
 if length(s)<26 then
 begin
  writeln('-1');
  halt;
 end;
 for i:=1 to length(s)-25 do
 begin
  for c:='A'to'Z'do a[c]:=0;
  z:=0;
  for j:=i to i+25 do
  if s[j]<>'?'then
  begin
   inc(a[s[j]]);
   if a[s[j]]>1 then z:=1;
  end;
  if z=0 then
  begin
   for c:='A'to'Z'do if a[c]=0 then w:=w+c;
   for j:=i to i+25 do
   if s[j]='?'then
   begin
    inc(z);
    s[j]:=w[z];
   end;
   for j:=1 to length(s)do
   if s[j]='?'then s[j]:='A';
   writeln(s);
   halt;
  end;
 end;
 writeln('-1');
end.

var s : ansistring;
    n, i, j, c, k : longint;
    f : array[0 .. 50010] of word;
begin
  read(s);
  n := length(s);
  for i := 1 to n - 25 do
    begin
      c := 0;
      for j := 0 to 25 do
        f[j]:=0;
      for j := i to i + 25 do
        if s[j] <> '?' then f[ord(s[j])- ord('A')] := 1
        else inc(c);
      for j := 0 to 25 do
        if f[j] > 0 then inc(c);
      if c = 26 then
        begin
          for j := i to i + 25 do
            if s[j] = '?' then
              for k := 0 to 25 do
                if f[k] = 0 then
                  begin
                    f[k] := 1;
                    s[j] := chr(k + ord('A'));
                    break;
                  end;
          for j := 1 to n do
            if s[j] = '?' then s[j] := 'A';
          write(s);
          halt;
        end;
    end;
  write(-1);
end.

uses strutils;

      const  eps=1e-11;  besk=8000000000000000000;
    modul=1000000007;
   label 1,2,3,4,11;
    type

    mas=array [-10000..1000000] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-10000..10000000] of int64;mass1=^mass;
    var aa,bb,olda1,olda2,ot,q1,aa2,bb2,aa1,bb1,t,t0,t1,p,kol,i1,j1,newdl,dl,kk,t2,m1,n1,pp,px,py,ll,cc,n2,dist,pos,dloch,x0,tt,v1,v2,p3,p4,t4,t5,t6,t3,xx,yy,ost,rr,q,h,n,qq,p1,p2,y0,s1,s2,m,imax,smin,besk1:int64;
     ii,jj,step,k,i,j:longint;
     c1,c2:array[-1000..100000] of int64;
     x,y:array[-10..65000,0..100] of int64;
     h1,h2:extended;
    dd1,dd2,newoch,sum,ugol,s,place,xnew,z,och,fact,d, a1,bl,br,c,a,b:array[-10000001..3000000] of int64;
    stoim:array[-10..1200,-10..1200] of int64;
    ss,ss1,ss2 :string;
    gr:array[-100..5000,-100..5000] of boolean;
    ssot:array[-100..10000] of char;
    ch: char;
    ppp:zap;
    pole,pole1:array[-10..1400,-10..1400] of char;
  prost, zan,marked:array[-1000001..1100000] of boolean;
    sss1,name1,name2,sp,sss,maxpr:array[0..1000000] of string;
  w,mm,nn,mm1,nn1,hh,ttt, l, aanew,v0,s0:extended;
   {  z,y,x:array[-1..300,-10..1000] of int64;
    }
    prvin,prlost,prob,x1,y1, xxx,yyy:array[-1..1000000] of extended;
   tt1, xxnew,per,pp2, ee,yot:double;
       flagg,flag2,flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

  function evkl(a,b:int64):zap1; var aa,bb,qq,d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
  tt:zap; tt1:zap1;
begin
  aa:=a;bb:=b;
  if a<b then begin r:=a;a:=b;b:=r; end;
  x2:=1;x1:=0;y2:=0;y1:=1; qq:=0;
  while b>0 do
    begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
          a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;
    end;
    d:=a; x:=x2;y:=y2;
  flag:=x*aa+y*bb=d;
    if flag then begin tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt; end;
  flag:=x*bb+y*aa=d;
    if flag then begin tt.p1:=d;tt.p2:=y;tt.p3:=x; tt1:=@tt; end;

   evkl:=tt1;
end;

function degg(modul,a:int64;k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=(degg(modul,a,k-1)*a) mod modul  else
   begin  p:=degg(modul,a,k div 2); degg:=(p*p) mod modul;    end;

end;

function good(ii,jj:longint):boolean;
var pp,i,j:longint; a:array[-100..300] of longint; fl:boolean;
  begin
     for i:=-1 to 50 do a[i]:=0; pp:=0;
     for i:=ii to jj do
     if ss[i]<>'?' then inc(a[ord(ss[i])-ord('A')]) else inc(pp);
     for i:=0 to 25 do if a[i]=0 then dec(pp);

  good:=pp>=0;

  end;

begin
{ assign (input,'input.txt');reset(input);
   assign (output,'output.txt'); rewrite(output);
 }

  readln(ss);
  n:=length(ss);

  if n<26 then  begin writeln(-1); goto 1;  end;
flag:=false;
for i:=1 to n-25 do if good(i,i+25) then begin flag:=true; ii:=i; end;
if not flag then begin writeln(-1); goto 1;  end;
 for i:=1  to ii-1 do if ss[i]<>'?' then  write(ss[i]) else write('A');
   for i:=-10 to 250 do a[i]:=0;
   pos:=-1;
   for i:=ii to ii+25 do inc(a[ord(ss[i])-ord('A')]);
  { writeln('pos= ',ii);
   for i:=0 to 25 do write(a[i],' '); writeln;
  } for i:=ii to ii+25 do if ss[i]<>'?' then write(ss[i]) else
     begin
        repeat inc(pos) until (a[pos]=0);
        write(chr(pos+ord('A')));
     end;

 for i:=ii+26 to n do if ss[i]<>'?' then  write(ss[i]) else write('A');
 writeln;

  1:               close(output);

end.

program yan;
  var ar:array['A'..'Z']of integer;
      i,j,x,y,a,b,n,m:longint; s:ansistring;   c:char;
begin
  readln(s);
  for i:=1 to length(s)-25 do
    begin
      a:=0;
      for c:='A' to 'Z' do ar[c]:=0;
      for j:=i to i+25 do
        if s[j]='?' then inc(a) else ar[s[j]]:=1;
      for c:='A' to 'Z' do
        if ar[c]=1 then inc(a);
      if a=26 then
        begin
          c:='A';
          for j:=i to i+25 do
            if s[j]='?' then
              begin
                while c<='Z' do
                  begin
                    if ar[c]=0 then
                      begin s[j]:=c; c:=chr(ord(c)+1); break; end;
                    c:=chr(ord(c)+1);
                  end;
              end;
          m:=1;
          break;
        end;
    end;
  if m=0 then begin write(-1); exit; end;
  for i:=1 to length(s) do
    if s[i]='?' then s[i]:='A';
  write(s);
end.

var
  s : ansistring;
  fk : boolean;
  i,j,n,m,k,l : longint;
  c,cc : char;
  ans : array[0..150000] of char;
  f : array['A'..'Z'] of longint;

begin
  readln(s); n:=length(s);
  for i:=1 to n-25 do begin
    for c:='A' to 'Z' do f[c]:=0;
    k:=0;
    for j:=i to i+25 do if s[j] in ['A'..'Z'] then inc(f[s[j]]);
    for j:=i to i+25 do
      if s[j] = '?' then begin
        cc:='A';
        for c:='B' to 'Z' do if f[c] < f[cc] then cc:=c;
        inc(k); ans[k]:=cc;
        inc(f[cc]);
      end;
    fk:=false;
    for c:='A' to 'Z' do if f[c] <> 1 then fk:=true;
    if not fk then begin
      for j:=i to i+25 do
        if s[j] = '?' then begin
          inc(l); s[j]:=ans[l];
        end;
      for j:=1 to n do
        if s[j] = '?' then s[j]:='A';
      writeln(s);
      halt;
    end;
  end;
  writeln(-1);
end.

program z1;
var a,b,c,d,i,j,k,l,m,n:longint;  s,s1,s2:ansistring;

Function TryFill(s1:ansistring):ansistring;
var i,j,k,l,m,qnum,znum,uk:longint; Z:array[1..26] of byte; ch:char; sm:string;
begin
qnum:=0; sm:=''; znum:=0;
for i:=1 to 26 do Z[i]:=0;
for i:=1 to 26 do
 begin
 if s1[i]='?' then inc(qnum) else inc(Z[ord(s1[i])-64]);
 end;
for i:=1 to 26 do if Z[i]=0 then begin inc(znum); sm:=sm+chr(i+64); end;
if qnum<>znum then exit('');
uk:=1;
for i:=1 to 26 do
if s1[i]='?' then begin s1[i]:=sm[uk]; inc(uk); end;
exit(s1);
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(s);
//writeln(s);
n:=length(s);
for i:=1 to (n-25) do
 begin
 s1:='';
 for j:=1 to 26 do s1:=s1+s[j+i-1];
// writeln(s1);
 s2:=TryFill(s1);
// writeln(s2);
 if s2<>'' then
  begin
  for j:=i to i+25 do s[j]:=s2[j-i+1];
  for j:=1 to n do if s[j]='?' then s[j]:='A';
  writeln(s);
  exit;
  end;
 end;
write('-1');
end.

Uses math;
Var fi, fo: text;
    n, i, j, k, p, t: Longint;
    S: AnsiString;
    c: array[0..50000,1..26] of Longint;
    found: Boolean;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, S);
	n:= Length(S);
	randomize;
	if n<26 then
	begin
		writeln(fo, -1);
		close(fi); close(fo);
		exit;
	end
	else
	begin
		for i:=1 to n do
		begin
			t:= ord(S[i])-64;
			if t>0 then
				for j:=1 to 26 do
					if j=t then c[i,j]:= c[i-1,j]+1
					else c[i,j]:= c[i-1,j]
			else
				for j:=1 to 26 do c[i,j]:= c[i-1,j];
		end;
		for i:=1 to n-26+1 do
		begin
			j:= i + 26 - 1;
			found:= true;
			for k:=1 to 26 do
				if c[j,k]-c[i-1,k]>1 then
				begin
					found:= false;
					break;
				end;
			if found then
			begin
				for k:=i to j do
					if S[k]='?' then
					begin
						for p:=1 to 26 do
							if c[j,p]-c[i-1,p]=0 then
							begin
								S[k]:= chr(p+64);
								inc(c[j,p]);
								break;
							end;
					end;
				for k:=1 to n do
					if S[k]<>'?' then write(fo, S[k])
					else write(fo, chr(1+random(26)+64));
				close(fi); close(fo);
				exit;
			end;
		end;
		if not(found) then
		begin
			writeln(fo, -1);
			close(fi); close(fo);
			exit;
		end;
	end;
End.

var s,x,y:ansistring;ch,t:char;i,j:longint;
f:array['A'..'Z'] of longint;g:boolean;
begin
//assign(input,'xzadz.in');reset(input);
//assign(output,'xzadz.out');rewrite(output);
readln(s);ch:=succ('Z');
for i:=1 to length(s)-25 do
  begin
  fillchar(f,sizeof(f),0);g:=false;
  for j:=i to i+25 do
    if s[j]<>'?' then
      begin
      inc(f[s[j]]);
      if f[s[j]]>1 then begin g:=true;break;end;
      end;
  if g then continue;
  t:='A';y:=s;
  while(t<='Z')and(f[t]>0)do t:=succ(t);
  for j:=i to i+25 do
    if y[j]='?' then
      begin
      y[j]:=t;t:=succ(t);
      while(t<='Z')and(f[t]>0)do t:=succ(t);
      end;
  if y[i]<ch then
    begin
    ch:=y[i];x:=y;
    end;
  end;
for i:=1 to length(x) do
  if x[i]='?' then x[i]:='A';
if ch>'Z' then writeln(-1) else writeln(x);
close(input);close(output);
end.

const
  fi='';
var
  i,n,d1,d2,tg:longint;
  st:ansistring;
  a:array[0..100] of longint;
  f:Text;
begin
  assign(f,fi); reset(f);
  readln(f,st);
  n:=length(st);
  for i:=1 to n do
    if st[i]<>'?' then
      begin
        tg:=ord(st[i])-65+1;
        inc(a[tg]);
        if a[tg]>=2 then
          begin
            writeln(-1); exit;
          end;
        if a[tg]=1 then inc(d1);
      end
    else inc(d2);
  if d1+d2>26 then
    begin
      writeln(-1); exit;
    end;
  tg:=1;
  for i:=1 to n do
    if st[i]='?' then
      begin
        while (tg<=26) and (a[tg]=1) do inc(tg);
        write(char(tg+65-1));
        tg:=tg+1;
      end
    else write(st[i]);
  readln;
end.

var
    s: ansistring;
    i, j, n, chamhoi, top: longint;
    b: array[0..500000] of char;
    a: array['A'..'Z'] of longint;
    c: char;
    nice: boolean;

begin
    //assign(input, 'b.inp'); reset(input);
    //assign(output, 'b.out'); rewrite(output);

    readln(s);
    if (length(s) <= 25) then
        writeln(-1)
    else
        begin
            for i:= 1 to length(s) - 25 do
                begin
                    nice:= true; top:= 0; chamhoi:= 0;
                    for j:= i to i + 25 do
                        if (s[j] = '?') then inc(chamhoi)
                    else
                        inc(a[s[j]]);
                    for c:= 'A' to 'Z' do
                        begin
                            if (a[c] = 0) then
                                begin
                                    inc(top);
                                    b[top]:= c;
                                end;
                            if (a[c] > 1) then nice:= false;
                        end;
                    if not(nice) then continue;
                    if (chamhoi - top <> 0) then continue;
                    for j:= i to i + 25 do
                        if (s[j] = '?') then
                            begin
                                s[j]:= b[top];
                                dec(top);
                            end;
                    if (i + 25 < length(s)) then
                        for j:= 1 to length(s) do
                            if (s[j] = '?') then s[j]:= 'A';
                    writeln(s);
                    halt;
                end;
        end;
    writeln(-1);
    //close(input); close(output);
end.

var i,j,n,count,cc,h,wt:longint;s:ansistring;
    used:array['A'..'Z']of longint;
procedure print(t:longint);
var i:longint;j:char;
begin
        for i:=t to t+26-1 do
        begin
             if s[i]<>'?' then write(s[i])
             else
                for j:='A' to 'Z' do
                    if used[j]<>count then begin used[j]:=count;write(j);break;end;
        end;
        wt:=1;
end;
begin
        //assign(input,'716B.inp');reset(input);
        //assign(output,'716B.out');rewrite(output);
        readln(s);
        n:=length(s);
        for i:=1 to n-26+1 do
        begin
                inc(count);h:=0;cc:=0;
                for j:=i to i+26-1 do
                    if(s[j]='?')then inc(h)
                    else if used[s[j]]<>count then
                    begin
                        used[s[j]]:=count;
                        inc(cc);
                    end;
                if cc+h=26 then begin print(i);break;end;
        end;
        if wt=0 then writeln(-1);
        close(input);close(output);
end.

Program B;
CONST FINP = '1.INP';	FOUT = '1.OUT';
VAR fi, fo: text;
s: ansistring;
n: longint;
d: array[0..60000, '?'..'Z'] of longint;

Function f(l, r: longint; c:char):longint;
BEGIN
exit(d[r][c] - d[l-1][c]);
END;

Function check(i: longint): boolean;
Var cnt, tmp: longint;
c: char;
BEGIN
cnt := 0;
for c := 'A' to 'Z' do
	begin
	tmp := f(i, i+25, c);
	if tmp > 1 then exit(false);
	cnt := cnt + tmp;
	end;
if 26-cnt = f(i, i+25, '?') then exit(true);
exit(false);
END;

Procedure g(i: longint);
Var j, j1: longint;
t: ansistring;
c: char;
BEGIN
j1 := 1;
t := '';
for c := 'A' to 'Z' do if f(i, i+25, c) = 0 then t := t + c;
for j := i to i+25 do if s[j] = '?' then
	begin
	s[j] := t[j1];
	inc(j1);
	end;
writeln(fo, copy(s, i, 26));
END;

Procedure Process;
Var i: longint;
c: char;
BEGIN
readln(fi, s);
n := length(s);
if (n < 26) then
	begin
	writeln(fo, -1);
	exit;
	end;
for i:=1 to n do
	for c := '?' to 'Z' do
		if s[i] = c then d[i][c] := d[i-1][c] + 1
			else d[i][c] := d[i-1][c];
for i:=1 to n-25 do if check(i) then
	begin
	g(i);
	exit;
	end;
writeln(fo, -1);
END;

BEGIN
{$IFDEF ONLINE_JUDGE}
assign(fi, '');		assign(fo, '');
{$ELSE}
assign(fi, FINP);	assign(fo, FOUT);
{$ENDIF}
reset(fi);			rewrite(fo);
Process;
close(fi);
close(fo);
END.

var n1,n:ansistring;
    i,k,q,d:integer;
    j:char;
    f:boolean;
begin
        read(n);
f:=false; q:=1; i:=q;
while (i<=length(n)-25) and (f=false) do
   begin
     n1:='';
     for d:=i to i+25 do
       n1:=n1+n[d];
     k:=0;
     for j:='A' to 'Z' do
       begin
         if (pos(j,n1)<>0) then
            begin
                inc(i);
                inc(k);
            end else
         if (pos(j,n1)=0) and (pos('?',n1)<>0) then
            begin
               insert(j,n1,pos('?',n1));
               delete(n1,pos('?',n1),1);
               inc(k);
               inc(i);
            end else break;
       end;
     if k=26 then f:=true else
        begin
          inc(q);
          i:=q;
        end;
   end;
if f=true then
   begin
      delete(n,q,26);
      insert(n1,n,i);
      for i:=1 to length(n) do
         if n[i]='?' then write('A') else write(n[i]);
   end else write(-1);
end.

Var s:ansistring;
    i,j:longint; l,r,f:int64;
    a:array[65..90] of int64;
    Begin
      readln(s);
      l:=1;
      r:=26;
      f:=1;
      if length(s)<26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
      if s[i]<>'?' then a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then

       while (r+1<=length(s)) do
       begin
        f:=1;
        r:=r+1;
        l:=l+1;
        a[ord(s[l-1])]:=a[ord(s[l-1])]-1;
        a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      if f=0 then writeln(-1)
       else
        for i:=l to r do
         if not(s[i]='?') then write(s[i])
         else
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end;
      End.

var a:array[1..50010] of longint;
b:array[1..30] of char;
st,st2:ansistring;
alf:string;
z:char;
n,i,j,k,p,q,r2,l2,kl:longint;

 procedure sort(l,r: longint);
      var
         i,j: longint;
         x,y: char;
      begin
         i:=l;
         j:=r;
         x:=b[i+random(j-i-1)];
         repeat
           while b[i]<x do
            inc(i);
           while x<b[j] do
            dec(j);
           if not(i>j) then
             begin
                y:=b[i];
                b[i]:=b[j];
                b[j]:=y;
                inc(i);
                j:=j-1;
             end;
         until i>j;
         if l<j then
           sort(l,j);
         if i<r then
           sort(i,r);
      end;

begin
  readln(st);
  alf:='QWERTYUIOPASDFGHJKLZXCVBNM';
  n:=length(st);
  if n<26 then begin
                 writeln('-1');
                 halt;
               end;
  for i:=1 to n do
    begin
      p:=pos(st[i],alf);
      if p>0 then a[p]:=a[p]+1;
    end;
  for i:=1 to n do
    begin
      z:=st[i];
      if z='?' then begin
                      for j:=1 to 26 do
                        if a[j]=0 then begin
                                         z:=alf[j];
                                         p:=pos(z,st);
                                         if ((p>0) and (abs(p-i)>26)) or (p=0) then begin
                                                                                st2:=st2+z;
                                                                                a[j]:=1;
                                                                                break;
                                                                                end
                                           else begin
                                                  k:=k+1;
                                                  z:=st2[k];
                                                  st2:=st2+z;
                                                end;

                                       end
                    end
               else st2:=st2+z;
    end;
  for l2:=1 to n-25 do
    begin
      q:=0;
      for r2:=l2 to l2+25 do
        begin
          q:=q+1;
          b[q]:=st2[r2];
        end;
      sort(l2,26);
      kl:=0;
      for r2:=2 to 26 do
        if b[r2]=b[r2-1] then kl:=1;
      if kl=0 then begin
                     writeln(st2);
                     halt;
                   end;
    end;
  writeln('-1');
end.

var
 i,j,k,n,t,l,k1:longint;
c,i1,m: qword;
 flag,flag1:integer;
s,alp:ansistring;

  x:array[1..2600000] of qword;

  Procedure qsort1(l,r:longint);
var p,z,i,j:longint;
begin
        z:=x[random(r-l)+l];
        i:=l;
        j:=r;
        Repeat
                while x[i]>z do inc(i);
                while x[j]<z do dec(j);
                if i<=j
                then begin
                        p:=x[i];
                        x[i]:=x[j];
                        x[j]:=p;
                        inc(i);
                        dec(j);
                end;
        Until i>j;
        if i<r
        then qsort1(i,r);
        if l<j
        then qsort1(l,j);
end;
function proverka:boolean;
var alp:ansistring;
j,l:longint;
x:array[1..260000]of integer;
flag,flag1:integer;
    begin
        l:=length(s);
        alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        i:=1;
        flag1:=0;

            //s1:=copy(s,i,26);
            flag:=1;
            for j:=1 to 26 do
                x[j]:=0;
            for j:=1 to l do begin
                if (s[j]=alp[j])then x[j]:=1;
            end;
            for j:=1 to 26 do
                if x[j]=0 then flag:=0;
            if flag=1 then flag1:=1;

        proverka:=(flag1=1);
    end;
begin
  readln(s);
///  writeln(s);
l:=length(s);
if l<26 then writeln(-1)
 else begin
    alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    i:=1;
    flag1:=0;
//    while ((i<=l)and(flag1=0)) do begin
 //       s1:=copy(s,i,26);
//        flag:=1;
//        for j:=1 to 26 do
 //           x[j]:=0;
 //       for j:=1 to 26 do begin
 //           if (s1[j]=alp[j])then x[j]:=1;
//        end;
 //       for j:=1 to 26 do
 //           if x[j]=0 then flag:=0;
//        if flag=1 then flag1:=1
//        else i:=i+1;
//    end;
//    if flag1=1 then begin
 //       while (pos('?',s)<>0) do  begin
//            i:=pos('?',s);
//            delete(s,i,1);
//            insert('A',s,i);
//        end;
//    end
 //   else begin //надо вставлять
     //   writeln(s);
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to l do begin
                if (s[i]=alp[i]) then x[i]:=1;
            end;
            for i:=1 to l do begin
                if (s[i]='?') then begin
                    flag1:=0;
                    j:=1;
                    while ((j<=26)and(flag1=0)) do begin
                        if x[j]=0 then begin
                            s[i]:=alp[j];
                            x[i]:=1;
                            flag1:=1;
                        end
                        else j:=j+1;
                    end;
                end;
            end;

            while (pos('?',s)<>0) do  begin
                i:=pos('?',s);
                delete(s,i,1);
                insert('A',s,i);
            end;

//    end;
   if (proverka) then
   writeln(s)
    else writeln(-1);
end;

end.

const fi = '';
      fo = '';
var a: array['A'..'Z'] of boolean;
    b: array[1..100000] of longint;
    i, j, x, m: longint;
    s: ansistring;
    c: char;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);

  readln(s);
  for i:=1 to length(s)-25 do
    begin
      x:=0;
      fillchar(a,sizeof(a),false);
      for j:=i to i+25 do
        if s[j] = '?' then
          begin
            inc(x);
            b[x]:=j;
          end
        else a[s[j]]:=true;
      m:=0;
      for c:='A' to 'Z' do if a[c] = false then inc(m);
      if m > x then continue;
      m:=0;
      for c:='A' to 'Z' do if a[c] = false then
        begin
          inc(m);
          s[b[m]]:=c;
        end;
      for j:=i+26 to length(s) do if s[i] = '?' then s[i]:='A';
      writeln(s);
      halt;
    end;
  writeln(-1);

  close(input); close(output);
end.

{$H+}
var
  a, b, c, d, i, j, t: int64;
  s: string;
  ar: array [1..1000] of int64;

begin
  readln(s);
  if length(s) < 26 then begin
    writeln(-1);
    halt();
  end;
  i := 1;
  a := 0;
  b := 0;
  while i <= 26 do
  begin
    if s[i] = '?' then inc(b)
    else if ar[ord(s[i])] = 0 then begin
      ar[ord(s[i])] := 1;
      inc(a);
    end
    else inc(ar[ord(s[i])]);
    inc(i);
  end;
  while i <= length(s) do
  begin
    if a + b = 26 then begin
      j := i - 26;
      while j < i do
      begin
        if s[j] <> '?' then write(s[j])
        else begin
          t := ord('A');
          while t <= ord('Z') do
          begin
            if ar[t] = 0 then begin
              ar[t] := 1;
              write(chr(t));
            end;
            inc(t);
          end;
        end;
        inc(j);
      end;
      halt();
    end;
    if s[i - 26] = '?' then dec(b)
    else begin
      if ar[ord(s[i - 26])] = 1 then dec(a);
      dec(ar[ord(s[i - 26])]);
    end;
    if s[i] = '?' then inc(b)
    else begin
      if ar[ord(s[i])] = 0 then inc(a);
      inc(ar[ord(s[i])]);
    end;
    inc(i);
  end;
  if a + b = 26 then begin
    j := i - 26;
    while j < i do
    begin
      if s[j] <> '?' then write(s[j])
      else begin
        t := ord('A');
        while t <= ord('Z') do
        begin
          if ar[t] = 0 then begin
            ar[t] := 1;
            write(chr(t));
          end;
          inc(t);
        end;
      end;
      inc(j);
    end;
    halt();
  end;
  writeln(-1);
end.

var s,s1:string;
a:array[1..26]of longint;
i,n,f,j:longint;
begin
readln(s);
n:=length(s);
if n<>26 then begin writeln(-1); exit; end;
s1:='ABCDEFGHIJKLMNOPQRSTVWUXYZ';
for i:=1 to 26 do
 for j:=1 to n do
if s1[i]=s[j] then a[i]:=a[i]+1;
for i:=1 to n do
if a[i]>1 then begin writeln(-1); exit; end;
i:=1;
while i<=n do begin
if s[i]='?' then  begin while s[i]='?' do begin delete(s,i,1);n:=n-1;if n<i then begin f:=1; break; end;end; if f=1 then break; end;
i:=i+1;
end;
 for i:=1 to 26 do
if a[i]=0 then begin
a[i]:=1; s:=s+s1[i];n:=n+1;
end;
f:=0;
for i:=1 to 26 do
if a[i]<>1 then f:=1;
if (n=26) and(f=0) then writeln(s)
else writeln(-1);
end.

var s,s1:ansistring;
a:array[1..26]of longint;
i,n,f,j:longint;
begin
readln(s);
n:=length(s);
if n<26 then begin writeln(-1); exit; end;
s1:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for i:=1 to 26 do
for j:=1 to n do
if s1[i]=s[j] then a[i]:=a[i]+1;
for i:=1 to n do
if a[i]>1 then begin writeln(-1); exit; end;
i:=1;
while i<=n do begin
if s[i]='?' then begin while s[i]='?' do begin delete(s,i,1);n:=n-1;if n<i then begin f:=1; break; end;end; if f=1 then break; end;
i:=i+1;
end;
for i:=1 to 26 do
if a[i]=0 then begin
a[i]:=1; s:=s+s1[i];n:=n+1;
end;
f:=0;
for i:=1 to 26 do
if a[i]<>1 then f:=1;
if (n=26) and(f=0) then writeln(s)
else writeln(-1);
end.

Uses math;
Var fi, fo: text;
    n, t, i, j, k: Longint;
    S: AnsiString;
    c: array[1..26] of Longint;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, S);
	n:= Length(S);
	i:= 1; j:= 2;
	if S[i]<>'?' then c[ord(S[i])-64]:= 1;
	while (i<=n) and (j<=n) do
	begin
		if S[j]<>'?' then
		begin
			if c[ord(S[j])-64]=1 then
			begin
				c[ord(S[i])-64]:= 0;
				inc(i);
			end
			else
			begin
				c[ord(S[j])-64]:= 1;
				if j-i+1=26 then break;
				inc(j);
			end;
		end
		else inc(j);
		if j-i+1>26 then inc(i);
	end;
	if j>n then
	begin
		dec(j);
		dec(i);
	end;
	randomize;
	if j-i+1=26 then
	begin
		for k:=1 to n do
			if S[k]='?' then
			begin
				if (k<i) or (k>j) then write(fo, chr(64+random(26)))
				else
					for t:=1 to 26 do
						if c[t]=0 then
						begin
							write(fo, chr(t+64));
							c[t]:= 1;
							break;
						end;
			end
			else write(fo, S[k]);
	end
	else write(fo, -1);
	close(fi); close(fo);
End.

        {$mode objfpc}
        {$coperators on}
uses math;
const
        {$ifdef online_judge}  fi=''; fo='';
        {$else} fi='inp.inp';
                fo='out.out';
        {$endif}

var
        f       :       array['A'..'Z']of longint;
        q       :       longint;
        s       :       ansistring;
        mis     :       array[1..40] of char;
procedure enter;
var i, j : integer;
        begin
                readln(s);
                if length(s)<26 then
                        begin
                                writeln(-1); halt;
                        end;
        end;
procedure ahihi(l,r:longint);
var i:char; b:boolean; c, ii:longint;
        begin
                c:=0;
                for i:='A' to 'Z' do if f[i]=0 then
                        begin
                                inc(c);
                                mis[c]:=i;
                        end;
                if q=c then
                        begin
                                c:=1;
                                for ii:=l to r do
                                        begin
                                                if s[ii]<>'?' then write(s[ii]) else
                                                 begin
                                                        write(mis[c]);
                                                        c+=1;
                                                 end;
                                        end;
                                halt;
                        end;
        end;
procedure solve;
var i, j : integer;
        begin
                q:=0;
                for i:=1 to 26 do
                        begin
                                if s[i]<>'?' then f[s[i]]+=1 else q:=q+1;
                        end;
                i:=1; j:=26;
                while(j<=length(s))do
                        begin
                                ahihi(i,j);
                                if s[i]<>'?' then f[s[i]]-=1 else q-=1;
                                i+=1; j+=1;
                                if j>length(s) then break;
                                if s[j]<>'?' then f[s[j]]+=1 else q+=1;
                        end;
                writeln(-1);
        end;
begin

        assign(input, fi); assign(output, fo); reset(input);  rewrite(output);
        enter;
        solve;
        close(input); close(output);
end.

var
 s:ansistring;
 len,i:longint;
 flag:boolean;

procedure comp(x:longint);
const
 ch:array[1..26] of char=('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');
var
 num:array[1..26] of longint;
 numq,i,j:longint;
 //st:ansistring;
begin
 fillchar(num,sizeof(num),0);
 numq:=0;
 for i:=x to x+26 do
  if (s[i]>='A')and(s[i]<='Z') then inc(num[ord(s[i])-64]) else inc(numq);
 for i:=x to x+26 do
  if s[i]='?' then begin
   j:=1;
   while num[j]<>0 do inc(j);
   num[j]:=1;
   s[i]:=ch[j];
  end;
end;

procedure check(x:longint);
var
 num:array[1..26] of longint;
 i:longint;
begin
 fillchar(num,sizeof(num),0);
 for i:=x to x+26 do
  if (s[i]>='A')and(s[i]<='Z') then begin
  inc(num[ord(s[i])-64]);
  if num[ord(s[i])-64]>1 then begin flag:=false;exit;end;
 end;
 flag:=true;
end;

begin
 readln(s);
 len:=length(s);
 if len<26 then begin writeln('-1');exit;end;
 for i:=1 to len-25 do begin
    check(i);
	if flag then comp(i);
 end;
 if flag then begin
  for i:=1 to len do
   if s[i]='?' then s[i]:='A';
  writeln(s);
  end else writeln('-1');
end.

{$h+}
var a:array['A'..'Z'] of longint;
    s,ss:string;
    ii:char;
    i,j,h,kol,p:longint;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output); }
readln(s);
ss:='';
for ii:='A' to 'Z' do
 ss:=ss+ii;
for i:=1 to length(s)-25 do
 begin
 for ii:='A' to 'Z' do
   a[ii]:=0;
 kol:=0;
 p:=0;
 for j:=1 to 26 do
   if s[i+j-1]='?' then inc(kol)
                   else
                        if a[s[i+j-1]]=0 then a[s[i+j-1]]:=1
                                         else begin p:=1; break; end;
  if p=0 then begin
              for j:=1 to 26 do
                if s[i+j-1]='?' then begin
                                     for ii:='A' to 'Z' do
                                       if a[ii]=0 then begin
                                                       a[ii]:=1;
                                                       write(ii);
                                                       break;
                                                       end;
                                    end
                                 else write(s[i+j-1]);
                halt;
                end;
 end;
write('-1');
{close(input);
close(output); }
end.

var
	s,s1 : ansistring;
	i,j,a,hah : longint;
	k : char;
	cek : boolean;
	ada : array['A'..'Z'] of boolean;

begin
	readln(s);
	cek := false;
	if length(s) < 26 then begin
		writeln(-1);
		exit;
	end;
	for i := 1 to (length(s)-25) do begin
		hah := 0;
		for k := 'A' to 'Z' do ada[k] := false;
		for j := i to i+25 do begin
			if ada[s[j]] then hah := 1;
			if s[j] <> '?' then ada[s[j]] := true;
		end;
		if hah = 0 then begin
			for j := i to i+25 do begin
				if s[j] = '?' then begin
					for k := 'A' to 'Z' do begin
						a := 0;
						if not(ada[k]) then begin
							s[j] := k;
							ada[k] := true;
							a := 1;
						end;
						if a = 1 then break;
					end;
				end;
			end;
			s1 := copy(s,length(s)-25,26);
			if pos('?',s1) = 0 then cek := true;
		end;
	end;
	while pos('?',s) <> 0 do s[pos('?',s)] := 'V';
	if cek then writeln(s)
	else writeln(-1);
end.

const
  fi='';
var
  st:ansistring;
  a:array[0..50000,0..27] of longint;
  chuaxet:array[0..27] of boolean;
  ok:boolean;
  f:Text;
  j,n,i,tg:longint;
begin
  assign(f,fi); reset(f);
  readln(f,st);
  n:=length(st);
  if n<26 then
    begin
      writeln(-1); exit;
    end;
  for i:=1 to n do
    if st[i]<>'?' then
    begin
      tg:=ord(st[i])-65+1;
      inc(a[i,tg]);
    end;
  for i:=1 to n do
    for j:=1 to 26 do a[i,j]:=a[i,j]+a[i-1,j];
  for i:=1 to n-26+1 do
    begin
      fillchar(chuaxet,sizeof(chuaxet),true);
      ok:=true;
      for j:=1 to 26 do
        if a[i+26-1,j]-a[i-1,j]>=2 then
          begin
            ok:=false; break;
          end
          else if a[i+26-1,j]-a[i-1,j]=1 then chuaxet[j]:=false;
        if ok then
          begin
            tg:=1;
            for j:=i to i+26-1 do
              if st[j]<>'?' then write(st[j])
              else
                begin
                  while (tg<=26) and (not chuaxet[tg]) do inc(tg);
                  write(char(tg+65-1));
                  inc(tg);
                end;
            readln;
            exit;
          end;
    end;
  writeln(-1);
  readln;
end.

Uses math;
Var fi, fo: text;
    n, t, i, j: Longint;
    S: AnsiString;
    c: array[1..26] of Longint;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, S);
	n:= length(S);
	if n>26 then
	begin
		writeln(fo, -1);
		close(fi); close(fo);
		exit;
	end
	else
	begin
		for j:=1 to n do
			if S[j]<>'?' then
			begin
				inc(c[ord(S[j])-64]);
				if c[ord(S[j])-64]>1 then
				begin
					writeln(fo, -1);
					close(fi); close(fo);
					exit;
				end;
			end;
	end;
	for j:=1 to n do
		if S[j]<>'?' then write(fo, S[j])
		else
			for i:=1 to 26 do
				if c[i]=0 then
				begin
					write(fo, chr(i+64));
					c[i]:= 1;
					break;
				end;
	close(fi); close(fo);
End.

const
   inp = 'input.txt';
   out = 'output.txt';
   maxn = 50000 + 5;

var
   n : longint;
   a, b : array[0..maxn] of longint;
   mark : array[0..26] of boolean;

procedure   init;
   var      i : longint;
            x : char;
   begin
      n := 0;
      while (not eof) do
         begin
            inc(n);
            read(x);
            if x = '?' then a[n] := 0
            else a[n] := ord(x) - ord('A') + 1;
         end;
   end;

procedure   solve;
   var      i, j, m : longint;
            check : boolean;
   begin
      for i := 1 to n - 25 do
         begin
            for j := 1 to 26 do mark[j] := false;
            check := true;

            for j := i to i + 26 - 1 do
               begin
                  if (a[j] > 0) then
                     if (mark[a[j]] = true) then
                        begin
                           check := false;
                           break;
                        end
                     else mark[a[j]] := true;
               end;
            if check = true then
               begin
                  m := 0;
                  for j := 1 to 26 do
                     if mark[j] = false then
                        begin
                           inc(m);
                           b[m] := j;
                        end;
                  m := 0;
                  for j := 1 to i - 1 do
                     if a[j] = 0 then write('?')
                     else write(chr(a[j] - 1 + ord('A')));

                  for j := i to i + 26 - 1 do
                     if a[j] > 0 then write(chr(a[j] - 1 + ord('A')))
                     else
                        begin
                           inc(m);
                           write(chr(b[m] - 1 + ord('A')));
                        end;

                  for j := i + 26 to n do
                     if a[j] = 0 then write('?')
                     else write(chr(a[j] - 1 + ord('A')));
                  break;
               end;
         end;
      if not check then writeln(-1);
   end;

begin
   //assign(input, inp); reset(input);
   //assign(output, out); rewrite(output);
   init;
   solve;
end.

const fi='b.inp';
      fo='b.out';
var s:ansistring;
    i,j:longint;
    d:array['A'..'Z']of longint;
    jj:char;
    ktt:boolean;
function kt:boolean;
var j:char;
    begin
        for j:='A' to 'Z' do
            if d[j]>1 then exit(false);
        exit(true);
    end;
begin
    //assign(input,fi);reset(input);
    //assign(output,fo);rewrite(output);
    ktt:=false;
    readln(s);
    if length(s)<26 then  ktt:=true;
    for i:=1 to length(s) do
        begin
            if s[i]<>'?' then inc(d[s[i]]);
            if i>=26 then
                begin
                    if kt=true then
                        begin
                        ktt:=true;
                        for j:=i-25 to i do
                            if s[j]='?' then
                                for jj:='A' to 'Z' do
                                    if d[jj]=0 then
                                    begin
                                        inc(d[jj]);
                                        s[j]:=jj;
                                        break;
                                        end;
                        break;
                        end;
                end;
            if (i>26)and (s[i-26]<>'?') then dec(d[s[i-26]]);
        end;
    for i:=1 to length(s) do
        if s[i]='?' then s[i]:='A';
    if ktt=false then writeln(-1) else writeln(s);
end.

Var s:ansistring;
    sc,l,r,i,j,f:longint;
    a:array[65..90] of longint;
    Begin
      readln(s);
      sc:=0;
      l:=1;
      r:=27;
      f:=0;
      if length(s)<26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
       if s[i]='?' then sc:=sc+1
        else a[ord(s[i])]:=a[ord(s[i])]+1;
       while (r<=length(s)) and (f=0) do
       begin
        for j:=65 to 90 do
         if a[j]>2 then f:=1;
        if s[l]='?' then sc:=sc-1
         else a[ord(s[l])]:=a[ord(s[l])]-1;
        if s[r]='?' then sc:=sc-1
         else a[ord(s[r])]:=a[ord(s[r])]-1;
        r:=r+1;
        l:=l+1;
       end;
      for j:=65 to 90 do
        if a[j]>1 then f:=1;
      if f=1 then writeln(-1)
       else
        for i:=l to r-1 do
         if s[i]='?' then
         begin
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end; end
            else write(s[i]);
      End.

var
	s : ansistring;
	i,j,a : longint;
	k : char;
	ada : array['A'..'Z'] of boolean;

begin
	readln(s);
	if length(s) < 26 then begin
		writeln(-1);
		exit;
	end;
	for i := 1 to (length(s)-25) do begin
		for k := 'A' to 'Z' do ada[k] := false;
		for j := i to i+25 do begin
			if ada[s[j]] then begin
				writeln(-1);
				exit;
			end;
			if s[j] <> '?' then ada[s[j]] := true;
		end;
		for j := i to i+25 do begin
			if s[j] = '?' then begin
				for k := 'A' to 'Z' do begin
					a := 0;
					if not(ada[k]) then begin
						s[j] := k;
						ada[k] := true;
						a := 1;
					end;
					if a = 1 then break;
				end;
			end;
		end;
	end;
	writeln(s);
end.

var
s,s1:ansistring;
a:array[1..26] of longint;
i,j,q:longint;
begin
readln(S);
//s:='ABC??FGHIJK???OPQR?TUVWXY?';

for i:=1 to length(S)-25 do begin
s1:=copy(s,i,26);
q:=0;
for j:=1 to 26 do
a[j]:=0;
for j:=1 to 26 do
if s1[j]<>'?'
then
inc(a[ord(s1[j])-64]);
for j:=1 to 26 do
if a[j]>1
then q:=1;
if q=0
then begin
for j:=i to i+25 do
if s[j]='?'
then for q:=1 to 26 do
if a[q]=0
then begin
s[j]:=chr(q+64);
inc(a[q]);
break;
end;
break;
end;
if i=length(s)-25
then begin writeln(-1);  halt;end;
end;
for i:=1 to length(S) do
if s[i]='?'
then s[i]:='A';
writeln(S);
end.

var possible:boolean;
	st:string;
	sum:int64;
	i,j:int32;
	count:array[1..30] of int64;
Begin
	Read(st);
	possible:=False;
	If (length(st)>=26) then
		Begin
			For i:=1 to length(st)-26+1 do
				If not possible then
					Begin
						Fillchar(count,sizeof(count),0);
						For j:=i to i+26 do
							Inc(count[Ord(st[i])-Ord('?')]);
						For j:=i to Ord('Z')-Ord('?') do
							If (count[i]>0) then inc(sum);
						dec(count[0]);
						If (count[0]<26-sum) or (count[0]>26-sum) then possible:=False
						Else
							Begin
								possible:=True;
								break;
							End;
					End;
		End;
	If possible then Writeln('1')
	Else Writeln('-1');
End.

var n,m,i,j,k,ned:longint;
    f:array['A'..'Z']of longint;
    s:ansistring;
    c:char;
begin
readln(s);
if length(s)<26 then begin writeln(-1);halt;end;
for j:=1 to 26 do begin
  if s[j]<>'?' then inc(f[s[j]]) else inc(k);
end;
for i:=1 to length(s)-25 do begin
  if i>1 then begin
    if s[i-1]='?' then dec(k) else dec(f[s[i-1]]);
    if s[i+25]='?' then inc(k) else inc(f[s[i+25]]);
  end;
  ned:=0;
  for c:='A' to 'Z' do if f[c]=0 then inc(ned);
  if ned<=k then begin
    for j:=1 to 26 do begin
      if s[i+j-1]<>'?' then write(s[i+j-1]) else begin
        for c:='A' to 'Z' do if f[c]=0 then begin inc(f[c]);write(c);break;end;
      end;
    end;
    halt;
  end;
end;
writeln(-1);
end.

var
   a:array ['A'..'Z'] of longint;
   s:string;
   top,i,n,h:longint;
procedure tx(i,j:longint);
   var
      f:longint;
      c:char;
   begin
   for f:=i+1 to j do
      if s[f]='?' then
         begin
         for c:='A' to 'Z' do
            if a[c]=0 then
               begin
               delete(s,f,1);
               insert(c,s,f);
               inc(a[c]);
               break;
               end;
         end;
   for f:=1 to n do
      if s[f]='?' then
         begin
         delete(s,f,1);
         insert('A',s,f);
         end;
   h:=1;
   end;
begin
readln(s);
if length(s)<26 then writeln('-1')
else
begin
n:=length(s);
for i:=1 to 26 do
   if s[i]<>'?' then
      begin
      if a[s[i]]=1 then inc(top);
      inc(a[s[i]]);
      end;
if top=0 then tx(0,26)
else
begin
for i:=2 to length(s)-26 do
if s[i]<>'?' then
   begin
   if a[s[i]]=2 then dec(top);
   dec(a[s[i]]);
   if s[i+26]<>'?' then
      begin
      if a[s[i+26]]=1 then inc(top);
      inc(a[s[i+26]]);
      end;
   if top=0 then
      begin
      tx(i,i+26);
      break;
      end;
   end;
end;
if h=1 then
writeln(s)
else
writeln('-1');
end;
end.

Uses math;
Var fi, fo: text;
    n, t, i, j, k: Longint;
    S: AnsiString;
    c: array[1..26] of Longint;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, S);
	n:= Length(S);
	i:= 1; j:= 2;
	if S[i]<>'?' then c[ord(S[i])-64]:= 1;
	while (i<=n) and (j<=n) do
	begin
		if S[j]<>'?' then
		begin
			if c[ord(S[j])-64]=1 then
			begin
				c[ord(S[i])-64]:= 0;
				inc(i);
			end
			else
			begin
				c[ord(S[j])-64]:= 1;
				if j-i+1=26 then break;
				inc(j);
			end;
		end
		else inc(j);
		if j-i+1>26 then inc(i);
	end;
	if j>n then
	begin
		dec(j);
		dec(i);
	end;
	randomize;
	if j-i+1=26 then
	begin
		for k:=1 to n do
			if S[k]='?' then
			begin
				if (k<i) or (k>j) then write(fo, chr(1+random(26)))
				else
					for t:=1 to 26 do
						if c[t]=0 then
						begin
							write(fo, chr(t+64));
							c[t]:= 1;
							break;
						end;
			end
			else write(fo, S[k]);
	end
	else write(fo, -1);
	close(fi); close(fo);
End.

var a:array['A'..'Z']of longint;
n,i,l,r:longint;
s,ans:ansistring;
c:char;
b:boolean;

procedure finish;
begin
for i:=l to r do
if s[i]='?'then
for c:='A' to 'Z' do
if a[c]=0 then begin a[c]:=1; s[i]:=c; break; end;
writeln(s);
halt;
end;

begin
ans:='';
readln(s);
n:=length(s);
for c:='A' to 'Z' do a[c]:=0;
if n<26 then
begin
write(-1);
halt;
end;
l:=1;
r:=26;
while r<=n do
begin
for c:='A' to 'Z' do a[c]:=0;
b:=true;
for i:=l to r do
if s[i]<>'?' then
begin
inc(a[s[i]]);
if a[s[i]]=2 then begin l:=l+1; r:=l+25; b:=false; break; end;
end;
if b then finish;
end;
write(-1);
end.

Var s:ansistring;
    i,j:longint; l,r,f:int64;
    a:array[65..90] of int64;
    Begin
      readln(s);
      l:=1;
      r:=26;
      f:=1;
      if length(s)<>26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
      if s[i]<>'?' then a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then

       while (r+1<=length(s)) do
       begin
        f:=1;
        r:=r+1;
        l:=l+1;
        a[ord(s[l-1])]:=a[ord(s[l-1])]-1;
        a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      if f=0 then writeln(-1)
       else
        for i:=l to r do
         if not(s[i]='?') then write(s[i])
         else
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end;
      End.

label 1;
var s,s2:string;
    i,j,k,no,ko:longint;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);  }
read(s);
if length(s)<26 then
begin
write(-1);
halt;
end;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
i:=1;
1: while i<=length(s)-25 do
begin
for j:=i to 25+i do
begin
if s[j]<>'?' then
begin
if pos(s[j],s2)=0 then
begin
inc(i);
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
goto 1;
end;
delete(s2,pos(s[j],s2),1);
end;
end;
no:=i;
ko:=25+i;
break;
end;
if i>length(s)-25 then
begin
write(-1);
halt;
end;
if s2='' then
begin
write(-1);
halt;
end;
k:=1;
for i:=1 to length(s) do
begin
if (i<no) or (ko<i) then
if (s[i]='?') then
write('A')
else
write(s[i]);
if (i>=no) and (i<=ko) then
if s[i]='?' then
begin
write(s2[k]);
inc(k);
end
else write(s[i]);
end;
{close(input);
close(output);}
end.

var
 i,j,k,n,t,l,l1,k1:longint;
c,i1,m: qword;
 flag,flag1:integer;
s,s1,alp:ansistring;

  x:array[1..2600000] of qword;

function proverka:boolean;
var alp,s1:ansistring;
i,j,l,k1:longint;
x:array[1..260000]of integer;
flag,flag1:integer;
    begin
        l:=length(s);
         flag1:=0;
    for k1:=1 to l do begin
        s1:=copy(s,k1,26);
        alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        i:=1;

            //s1:=copy(s,i,26);
            flag:=1;
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to 26 do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for j:=1 to 26 do
                if x[j]=0 then flag:=0;
            if flag=1 then flag1:=1;
    end;
        proverka:=(flag1=1);
    end;
begin
  readln(s);
///  writeln(s);
l:=length(s);
if l<26 then writeln(-1)
 else begin
    alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    i:=1;
    flag1:=0;
//    while ((i<=l)and(flag1=0)) do begin
 //       s1:=copy(s,i,26);
//        flag:=1;
//        for j:=1 to 26 do
 //           x[j]:=0;
 //       for j:=1 to 26 do begin
 //           if (s1[j]=alp[j])then x[j]:=1;
//        end;
 //       for j:=1 to 26 do
 //           if x[j]=0 then flag:=0;
//        if flag=1 then flag1:=1
//        else i:=i+1;
//    end;
//    if flag1=1 then begin
 //       while (pos('?',s)<>0) do  begin
//            i:=pos('?',s);
//            delete(s,i,1);
//            insert('A',s,i);
//        end;
//    end
 //   else begin //надо вставлять
     //   writeln(s);
    for k1:=1 to l do begin
        s1:=copy(s,k1,26);
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to 26 do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for i:=1 to 26 do begin
                if (s1[i]='?') then begin
                    flag1:=0;
                    j:=1;
                    while ((j<=26)and(flag1=0)) do begin
                        if x[j]=0 then begin
                            s1[i]:=alp[j];
                            x[j]:=1;
                            flag1:=1;
                        end
                        else j:=j+1;
                    end;
                end;
            end;

            while (pos('?',s1)<>0) do  begin
                i:=pos('?',s1);
                delete(s1,i,1);
                insert('A',s1,i);
            end;
        delete(s,k1,26);
        insert(s1,s,k1);
        while (pos('?',s)<>0) do  begin
                i:=pos('?',s);
                delete(s,i,1);
                insert('A',s,i);
        end;
     //   writeln(s1);
    end;
//writeln(s);
   if (proverka) then
   writeln(s)
    else writeln(-1);
end;

end.

var alf,st:ansistring;
l,i,j,kol,p:longint;
a:array[0..100] of longint;
begin
  alf:='QWERTYUIOPASDFGHJKLZXCVBNM';
  readln(st);
  l:=length(st);
  for i:=1 to l do
    if st[i]<>'?' then begin
                         p:=0;
                         p:=pos(st[i],alf);
                         if a[p]=1 then begin
                                          writeln(-1);
                                          halt;
                                        end
                    else if a[p]=0 then a[p]:=1;
                       end
                  else kol:=kol+1;
  if l=26 then begin
                 if kol=0 then writeln(st)
             else begin
                    for i:=1 to l do
                      if st[i]='?' then begin
                                          for j:=1 to 26 do
                                            if a[j]=0 then begin
                                                             a[j]:=1;
                                                             break;
                                                           end;
                                          st[i]:=alf[j];
                                        end;
                    writeln(st);
                  end;
               end
else begin
       writeln(-1);
     end;
end.

const fi = '';
      fo = '';
var a: array['A'..'Z'] of boolean;
    b: array[1..100000] of longint;
    i, j, x, m: longint;
    s: ansistring;
    c: char;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);

  readln(s);
  for i:=1 to length(s)-25 do
    begin
      x:=0;
      fillchar(a,sizeof(a),false);
      for j:=i to i+25 do
        if s[j] = '?' then
          begin
            inc(x);
            b[x]:=j;
          end
        else a[s[j]]:=true;
      m:=0;
      for c:='A' to 'Z' do if a[c] = false then inc(m);
      if m > x then continue;
      m:=0;
      for c:='A' to 'Z' do if a[c] = false then
        begin
          inc(m);
          s[b[m]]:=c;
        end;
      for j:=i+26 to length(s) do if s[j] = '?' then s[j]:='A';
      writeln(s);
      halt;
    end;
  writeln(-1);

  close(input); close(output);
end.

label 1;
var s,s2:string;
    i,j,k,no,ko:longint;
begin
read(s);
if length(s)<26 then
begin
write(-1);
halt;
end;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
i:=1;
1: while i<=length(s)-25 do
begin
for j:=i to 25+i do
begin
if s[j]<>'?' then
begin
if pos(s[j],s2)=0 then
begin
i:=j+1;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
goto 1;
end;
delete(s2,pos(s[j],s2),1);
end;
end;
no:=i;
ko:=25+i;
break;
end;
if i>length(s)-25 then
begin
write(-1);
halt;
end;
{if s2='' then
begin
write(-1);
halt;
end;}
k:=1;
for i:=no to ko do
if s[i]='?' then
begin
write(s2[k]);
inc(k);
end
else write(s[i]);
end.

var
 i,j,k,n,t,l,k1:longint;
c,i1,m: qword;
 flag,flag1:integer;
s,alp:ansistring;

  x:array[1..2600000] of qword;

function proverka:boolean;
var alp:ansistring;
i,j,l:longint;
x:array[1..260000]of integer;
flag,flag1:integer;
    begin
        l:=length(s);
        alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        i:=1;
        flag1:=0;

            //s1:=copy(s,i,26);
            flag:=1;
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to l do begin
                for j:=1 to 26 do begin
                    if (s[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for j:=1 to 26 do
                if x[j]=0 then flag:=0;
            if flag=1 then flag1:=1;

        proverka:=(flag1=1);
    end;
begin
  readln(s);
///  writeln(s);
l:=length(s);
if l<26 then writeln(-1)
 else begin
    alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    i:=1;
    flag1:=0;
//    while ((i<=l)and(flag1=0)) do begin
 //       s1:=copy(s,i,26);
//        flag:=1;
//        for j:=1 to 26 do
 //           x[j]:=0;
 //       for j:=1 to 26 do begin
 //           if (s1[j]=alp[j])then x[j]:=1;
//        end;
 //       for j:=1 to 26 do
 //           if x[j]=0 then flag:=0;
//        if flag=1 then flag1:=1
//        else i:=i+1;
//    end;
//    if flag1=1 then begin
 //       while (pos('?',s)<>0) do  begin
//            i:=pos('?',s);
//            delete(s,i,1);
//            insert('A',s,i);
//        end;
//    end
 //   else begin //надо вставлять
     //   writeln(s);
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to l do begin
                for j:=1 to 26 do begin
                    if (s[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for i:=1 to l do begin
                if (s[i]='?') then begin
                    flag1:=0;
                    j:=1;
                    while ((j<=26)and(flag1=0)) do begin
                        if x[j]=0 then begin
                            s[i]:=alp[j];
                            x[j]:=1;
                            flag1:=1;
                        end
                        else j:=j+1;
                    end;
                end;
            end;

            while (pos('?',s)<>0) do  begin
                i:=pos('?',s);
                delete(s,i,1);
                insert('A',s,i);
            end;

//    end;
//writeln(s);
   if (proverka) then
   writeln(s)
    else writeln(-1);
end;

end.

var a:array['A'..'Z']of longint;
n,i,l,r:longint;
s,ans:ansistring;
c:char;
b:boolean;

procedure finish;
begin
for i:=l to r do
if s[i]<>'?'then
ans:=ans+s[i] else
for c:='A' to 'Z' do
if a[c]=0 then begin a[c]:=1; ans:=ans+c; break; end;
writeln(ans);
halt;
end;

begin
ans:='';
readln(s);
n:=length(s);
for c:='A' to 'Z' do a[c]:=0;
if n<26 then
begin
write(-1);
halt;
end;
l:=1;
r:=26;
while l+25<=n do
begin
for c:='A' to 'Z' do a[c]:=0;
b:=true;
for i:=l to r do
if s[i]<>'?' then
begin
inc(a[s[i]]);
if a[s[i]]=2 then begin l:=l+1; r:=l+25; b:=false; break; end
end;
if b then finish;
end;
write(-1);
end.

var
 s:ansistring;
 len,i:longint;
 flag:boolean;

procedure comp(x:longint);
const
 ch:array[1..26] of char=('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');
var
 num:array[1..26] of longint;
 numq,i,j:longint;
begin
 fillchar(num,sizeof(num),0);
 numq:=0;
 for i:=x to x+25 do
  if (s[i]>='A')and(s[i]<='Z') then inc(num[ord(s[i])-64]) else inc(numq);
 for i:=x to x+25 do
  if s[i]='?' then begin
   j:=1;
   while num[j]<>0 do inc(j);
   num[j]:=1;
   s[i]:=ch[j];
  end;
end;

procedure check(x:longint);
var
 num:array[1..26] of longint;
 i:longint;
begin
 fillchar(num,sizeof(num),0);
 for i:=x to x+26 do
  if (s[i]>='A')and(s[i]<='Z') then begin
  inc(num[ord(s[i])-64]);
  if num[ord(s[i])-64]>1 then begin flag:=false;exit;end;
 end;
 flag:=true;
end;

begin
 readln(s);
 len:=length(s);
 if len<26 then begin writeln('-1');exit;end;
 for i:=1 to len-25 do begin
    check(i);
	if flag then begin comp(i);break;end;
 end;
 //writeln(s);
// writeln(len);
 if flag then begin
  for i:=1 to len do
   if s[i]='?' then s[i]:='A';
  writeln(s);
  end else writeln('-1');
end.

program z1;
var a,b,c,d,i,j,k,l,m,n:longint;  s,s1,s2:ansistring;

Function TryFill(s1:ansistring):ansistring;
var i,j,k,l,m,qnum,znum,uk:longint; Z:array[1..26] of byte; ch:char; sm:string;
begin
qnum:=0; sm:='';
for i:=1 to 26 do Z[i]:=0;
for i:=1 to 26 do
 begin
 if s1[i]='?' then inc(qnum) else inc(Z[ord(s1[i])-64]);
 end;
for i:=1 to 26 do if Z[i]=0 then begin inc(znum); sm:=sm+chr(i+64); end;
if qnum<>znum then exit('');
uk:=1;
for i:=1 to 26 do
if s1[i]='?' then begin s1[i]:=sm[uk]; inc(uk); end;
exit(s1);
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(s);
for i:=1 to (length(s)-25) do
 begin
 s1:=copy(s,i,26);
 s2:=TryFill(s1);
 if s2<>'' then
  begin
  delete(s,i,26);
  insert(s2,s,i);
  for j:=1 to length(s) do if s[j]='?' then s[j]:='A';
  writeln(s);
  exit;
  end;
 end;
write('-1');
end.

var
  s,s2:ansistring;
  len,i,j,z,p:longint;
  ch:char;
  bo:boolean;
  c:array[0..100]of char;
  b:array['?'..'Z']of boolean;
begin
  read(s);
  len:=length(s);
  bo:=true;
  for i:=1 to len-25 do
    begin
      fillchar(b,sizeof(b),false);
      p:=0;
      for j:=1 to 27 do
        begin
          if j=27 then break;
          if s[i+j-1]='?' then inc(p)
          else begin
          if b[s[j]] then break
          else b[s[j]]:=true;
          end;
        end;
      if j<27 then continue;
      z:=0;
      for ch:='A' to 'Z' do
        begin
          if not b[ch] then
          begin
            inc(z);
            c[z]:=ch;
          end;
        end;
      s2:=s;
      z:=0;
      for j:=1 to 26 do
        if s2[i+j-1]='?' then begin
          inc(z);
          s2[i+j-1]:=c[z];
          end;
      bo:=false;
      break;
    end;
  if bo then write(-1)
  else begin
         for i:=1 to len do
           begin
             if s2[i]='?' then write('A')
             else write(s2[i]);
           end;
       end;
end.

Uses math;
Var fi, fo: text;
    n, t, i, j, k: Longint;
    S: AnsiString;
    c: array[1..26] of Longint;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, S);
	n:= Length(S);
	i:= 1; j:= 2;
	if S[i]<>'?' then c[ord(S[i])-64]:= 1;
	while (i<=n) and (j<=n) do
	begin
		if S[j]<>'?' then
		begin
			if c[ord(S[j])-64]=1 then
			begin
				c[ord(S[i])-64]:= 0;
				inc(i);
			end
			else
			begin
				c[ord(S[j])-64]:= 1;
				if j-i+1=26 then break;
				inc(j);
			end;
		end
		else inc(j);
		if j-i+1>26 then inc(i);
	end;
	if j>n then
	begin
		dec(j);
		dec(i);
	end;
	randomize;
	if j-i+1=26 then
	begin
		for k:=1 to n do
			if S[k]='?' then
			begin
				if (k<i) or (k>j) then write(fo, chr(65+random(26)))
				else
					for t:=1 to 26 do
						if c[t]=0 then
						begin
							write(fo, chr(t+64));
							c[t]:= 1;
							break;
						end;
			end
			else write(fo, S[k]);
	end
	else write(fo, -1);
	close(fi); close(fo);
End.

function nice(const s:string):boolean;
  var i,sum,temp:integer;
      r:boolean;
      x:char;
      ans:string;
      a:array['A'..'Z'] of integer;
begin
    temp:=0;
    ans:=s;
    sum:=0;
    for x:='A' to 'Z' do a[x]:=0;
    for i:=1 to length(S) do
    if (s[i]='?') then temp:=temp+1 else a[s[i]]:=1;
    for x:='A' to 'Z' do sum:=sum+a[x];
    if (sum+temp<26) then nice:=false else begin
       for x:='A' to 'Z' do begin
            if ((a[x]=0) and (temp>0)) then begin
                insert(x,ans,pos('?',ans));
                delete(ans,pos('?',ans),1);
            end;
       end;
       writeln(ans);
       nice:=true;
    end;

end;
var s,t:string;
    i:integer;
    ans:boolean;
begin
    readln(s);
    ans:=false;
    t:='';
    if (length(s)<26) then write(-1) else begin
    for i:=1 to length(s)-25 do begin
      t:=copy(s,i,26);
      if nice(t) then begin
      ans:=true;
      break;
      end;
    end;
    if not ans then write(-1);
    end;
end.

{$H+}
var a:array['A'..'Z'] of longint;
    s,ss:string;
    ii:char;
    i,j,h,kol,p:longint;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);}
read(s);
if length(s)<26 then begin writeln('-1'); halt; end;
for i:=1 to length(s)-25 do
 begin
 for ii:='A' to 'Z' do
   a[ii]:=0;
 kol:=0;
 p:=0;
 for j:=1 to 26 do
   if s[i+j-1]='?' then inc(kol)
                   else
                        if a[s[i+j-1]]=0 then a[s[i+j-1]]:=1
                                         else begin p:=1; break; end;
  if p=0 then begin
              for j:=1 to 26 do
                if s[i+j-1]='?' then begin
                                     for ii:='A' to 'Z' do
                                       if a[ii]=0 then begin
                                                       a[ii]:=1;
                                                       write(ii);
                                                       break;
                                                       end;
                                     end
                                 else write(s[i+j-1]);
                halt;
                end;
 end;
writeln('-1');
{close(input);
close(output);   }
end.

const
   inp = 'input.txt';
   out = 'output.txt';
   maxn = 500000 + 5;

var
   n : longint;
   a, b : array[0..maxn] of longint;
   mark : array[0..27] of boolean;

procedure   init;
   var      i : longint;
            x : char;
   begin
      n := 0;
      while (not seekeof) do
         begin
            inc(n);
            read(x);
            if x = '?' then a[n] := 0
            else a[n] := ord(x) - ord('A') + 1;
         end;
   end;

procedure   solve;
   var      i, j, m : longint;
            check : boolean;
   begin
      for i := 1 to n - 25 do
         begin
            for j := 1 to 26 do mark[j] := false;
            check := true;

            for j := i to i + 25 do
               if (a[j] > 0) then
                  if (mark[a[j]] = true) then
                     begin
                        check := false;
                        break;
                     end
                  else mark[a[j]] := true;

            if check = true then
               begin
                  m := 0;
                  for j := 1 to 26 do
                     if mark[j] = false then
                        begin
                           inc(m);
                           b[m] := j;
                        end;

                  m := 0;
                  for j := i to i + 25 do
                     if a[j] > 0 then write(chr(a[j] - 1 + ord('A')))
                     else
                        begin
                           inc(m);
                           write(chr(b[m] - 1 + ord('A')));
                        end;

                  exit;
               end;
         end;
      if not check then writeln(-1);
   end;

begin
   //assign(input, inp); reset(input);
   //assign(output, out); rewrite(output);
   init;
   solve;
end.

var
 s:ansistring;
 a:array[65..90]of longint;
 n,k,i,l,r,p,j:longint;

procedure ans(s:ansistring);
begin
 writeln(s);
 halt;
end;

function check:boolean;
var
 i,k1:longint;
begin
 k1:=0;
 for i:=65 to 90 do if a[i]>1 then exit(false) else if a[i]=1 then inc(k1);
 if k1+k=26 then exit(true) else exit(false);
end;

begin
 readln(s);
 if length(s)<26 then ans('-1');
 for i:=1 to 26 do if s[i]<>'?' then inc(a[ord(s[i])]) else inc(k);
 l:=1;
 r:=26;

 if check then
 begin
  p:=64;
  for i:=1 to length(s) do if s[i]='?' then
  begin
   if (i<l)and(i>r) then s[i]:='A' else
   begin
    for j:=p+1 to 90 do if a[j]=0 then
    begin
     s[i]:=chr(j);
     p:=j;
     break;
    end;
   end;
  end;
  ans(s);
 end;

 repeat
  inc(r);
  if s[r]<>'?' then inc(a[ord(s[r])]) else inc(k);
  if s[l]<>'?' then dec(a[ord(s[l])]) else dec(k);
  inc(l);
  if check then
  begin
   p:=64;
   for i:=1 to length(s) do if s[i]='?' then
   begin
    if (i<l)and(i>r) then s[i]:='A' else
    begin
     for j:=p+1 to 90 do if a[j]=0 then
     begin
      s[i]:=chr(j);
      p:=j;
      break;
     end;
    end;
   end;
   ans(s);
  end;
 until r=length(s);
 ans('-1');
end.

var i,j,m,n,len,k:longint;
    pfx:array[0..50005,0..25]of longint;
    s:ansistring;
    used:array[0..25]of boolean;
    flag:boolean;
begin
    readln(s);
    len:=length(s);
    for i:=1 to len do begin
       if s[i]='?' then begin
           for j:=0 to 25 do pfx[i,j]:=pfx[i-1,j];
       end else begin
           for j:=0 to 25 do if ord('A')+j<>ord(s[i]) then pfx[i,j]:=pfx[i-1,j] else pfx[i,j]:=pfx[i-1,j]+1;
       end;
    end;
    if len<26 then writeln(-1) else begin
        for i:=1 to len-25 do begin
            flag:=true;
            for j:=0 to 25 do begin
                if pfx[i+25,j]-pfx[i-1,j]>1 then flag:=false;
            end;
            if flag then begin
               fillchar(used,sizeof(used),false);
               for j:=i to i+25 do if s[j]<>'?' then used[ord(s[i])-ord('A')]:=true;
               for j:=i to i+25 do begin
                   if s[j]<>'?' then write(s[j]) else begin
                       for k:=0 to 25 do if used[k]=false then begin
                           write(chr(k+ord('A')));
                           used[k]:=true;
                       end;
                   end;
               end;
               writeln;
               //close input output
               halt;
            end;
        end;
    end;
    writeln(-1);
end.

label 1;
var s,s2:string;
    i,j,k,no,ko:longint;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output); }
read(s);
if length(s)<26 then
begin
write(-1);
halt;
end;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
i:=1;
1: while i<=length(s)-25 do
begin
for j:=i to 25+i do
begin
if s[j]<>'?' then
begin
if pos(s[j],s2)=0 then
begin
i:=j;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
goto 1;
end;
delete(s2,pos(s[j],s2),1);
end;
end;
no:=i-1;
ko:=25+i;
break;
end;
if i>length(s)-25 then
begin
write(-1);
halt;
end;
if s2='' then
begin
write(-1);
halt;
end;
k:=1;
for i:=1 to length(s) do
begin
if (i<no) or (ko<i) then
if (s[i]='?') then
write('A')
else
write(s[i]);
if (i>=no) and (i<=ko) then
if s[i]='?' then
begin
write(s2[k]);
inc(k);
end
else write(s[i]);
end;
{close(input);
close(output);}
end.

Var s:ansistring;
    i,j:longint; l,r,f,sc:int64;
    a:array[65..90] of int64;
    Begin
      readln(s);
      sc:=0;
      l:=1;
      r:=26;
      f:=1;
      if length(s)<26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
       if s[i]='?' then sc:=sc+1
        else a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then

       while (r+1<=length(s)) do
       begin
        f:=1;
        r:=r+1;
        l:=l+1;
        if s[l-1]='?' then sc:=sc-1
         else a[ord(s[l-1])]:=a[ord(s[l-1])]-1;
        if s[r]='?' then sc:=sc+1
         else a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      if f=0 then writeln(-1)
       else
        for i:=l to r do
         if s[i]='?' then
         begin
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end; end
            else write(s[i]);
      End.

uses strutils;

      const  eps=1e-11;  besk=8000000000000000000;
    modul=1000000007;
   label 1,2,3,4,11;
    type

    mas=array [-10000..1000000] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-10000..10000000] of int64;mass1=^mass;
    var aa,bb,olda1,olda2,ot,q1,aa2,bb2,aa1,bb1,t,t0,t1,p,kol,i1,j1,newdl,dl,kk,t2,m1,n1,pp,px,py,ll,cc,n2,dist,pos,dloch,x0,tt,v1,v2,p3,p4,t4,t5,t6,t3,xx,yy,ost,rr,q,h,n,qq,p1,p2,y0,s1,s2,m,imax,smin,besk1:int64;
     ii,jj,step,k,i,j:longint;
     c1,c2:array[-1000..100000] of int64;
     x,y:array[-10..65000,0..100] of int64;
     h1,h2:extended;
    dd1,dd2,newoch,sum,ugol,s,place,xnew,z,och,fact,d, a1,bl,br,c,a,b:array[-10000001..3000000] of int64;
    stoim:array[-10..1200,-10..1200] of int64;
    ss,ss1,ss2 :string;
    gr:array[-100..5000,-100..5000] of boolean;
    ssot:array[-100..10000] of char;
    ch: char;
    ppp:zap;
    pole,pole1:array[-10..1400,-10..1400] of char;
  prost, zan,marked:array[-1000001..1100000] of boolean;
    sss1,name1,name2,sp,sss,maxpr:array[0..1000000] of string;
  w,mm,nn,mm1,nn1,hh,ttt, l, aanew,v0,s0:extended;
   {  z,y,x:array[-1..300,-10..1000] of int64;
    }
    prvin,prlost,prob,x1,y1, xxx,yyy:array[-1..1000000] of extended;
   tt1, xxnew,per,pp2, ee,yot:double;
       flagg,flag2,flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

  function evkl(a,b:int64):zap1; var aa,bb,qq,d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
  tt:zap; tt1:zap1;
begin
  aa:=a;bb:=b;
  if a<b then begin r:=a;a:=b;b:=r; end;
  x2:=1;x1:=0;y2:=0;y1:=1; qq:=0;
  while b>0 do
    begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
          a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;
    end;
    d:=a; x:=x2;y:=y2;
  flag:=x*aa+y*bb=d;
    if flag then begin tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt; end;
  flag:=x*bb+y*aa=d;
    if flag then begin tt.p1:=d;tt.p2:=y;tt.p3:=x; tt1:=@tt; end;

   evkl:=tt1;
end;

function degg(modul,a:int64;k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=(degg(modul,a,k-1)*a) mod modul  else
   begin  p:=degg(modul,a,k div 2); degg:=(p*p) mod modul;    end;

end;

function good(ii,jj:longint):boolean;
var pp,i,j:longint; a:array[-100..300] of longint; fl:boolean;
  begin
     for i:=-1 to 50 do a[i]:=0; pp:=0;
     for i:=ii to jj do
     if ss[i]<>'?' then inc(a[ord(ss[i])-ord('A')]) else inc(pp);
     for i:=0 to 25 do if a[i]=0 then dec(pp);

  good:=pp>=0;

  end;

begin
 {assign (input,'input.txt');reset(input);
   assign (output,'output.txt'); rewrite(output);
  }

  readln(ss);
  n:=length(ss);

  if n<26 then  begin writeln(-1); goto 1;  end;
flag:=false;
for i:=1 to n-25 do if good(i,i+25) then begin flag:=true; pos:=i; end;
if not flag then begin writeln(-1); goto 1;  end;
 for i:=1  to pos-1 do write(ss[i]);
   for i:=0 to 25 do a[i]:=0;
   pos:=26;
   for i:=ii to ii+25 do inc(a[ord(ss[i])-ord('A')]);
   for i:=ii to ii+25 do if ss[i]<>'?' then write(ss[i]) else
     begin
        repeat dec(pos) until (a[pos]=0) or (pos<0);
        write(chr(pos+ord('A')));
     end;

 for i:=pos+26 to n do write(ss[i]);
 writeln;

  1:               close(output);

end.

Uses math;
Var fi, fo: text;
    n, t, i, j: Longint;
    S: AnsiString;
    c: array[1..26] of Longint;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, S);
	n:= length(S);
	if n>26 then
	begin
		writeln(fo, -1);
		close(fi); close(fo);
		exit;
	end
	else
	begin
		for j:=1 to n do
			if S[j]<>'?' then
			begin
				inc(c[ord(S[j])-64]);
				if c[ord(S[j])-64]>1 then
				begin
					writeln(fo, -1);
					close(fi); close(fo);
					exit;
				end;
			end;
	end;
	for j:=1 to n do
		if S[j]<>'?' then write(fo, S[j])
		else
			for i:=1 to 26 do
				if c[i]=0 then
				begin
					write(fo, chr(i+64));
					c[i]:= 1;
					break;
				end;
	close(fi); close(fo);
End.

var
   a:array ['A'..'Z'] of longint;
   s:ansistring;
   top,i,n,h:longint;
procedure tx(i,j:longint);
   var
      f:longint;
      c:char;
   begin
   for f:=i+1 to j do
      if s[f]='?' then
         begin
         for c:='A' to 'Z' do
            if a[c]=0 then
               begin
               delete(s,f,1);
               insert(c,s,f);
               inc(a[c]);
               break;
               end;
         end;
   for f:=1 to n do
      if s[f]='?' then
         begin
         delete(s,f,1);
         insert('A',s,f);
         end;
   h:=1;
   end;
begin
readln(s);
if length(s)<26 then writeln('-1')
else
begin
n:=length(s);
for i:=1 to 26 do
   if s[i]<>'?' then
      begin
      if a[s[i]]=1 then inc(top);
      inc(a[s[i]]);
      end;
if top=0 then tx(0,26)
else
begin
for i:=2 to length(s)-25 do
if s[i]<>'?' then
   begin
   if a[s[i]]=2 then dec(top);
   dec(a[s[i]]);
   if s[i+26]<>'?' then
      begin
      if a[s[i+26]]=1 then inc(top);
      inc(a[s[i+26]]);
      end;
   if top=0 then
      begin
      tx(i,i+26);
      break;
      end;
   end;
end;
if h=1 then
writeln(s)
else
writeln('-1');
end;
end.

var
n,i,j,j1,p:longint;
st,st2,st3:ansistring;
a:array[0..100] of int64;
procedure prov;
 begin
  for j:=1 to 26 do
  begin
   if a[j]>1 then exit;
  end;
  for j:=1 to 26 do
   begin
    if a[j]=0 then begin
                    for j1:=i-25 to i do
                     begin
                      if st[j1]='?' then begin
                                          st[j1]:=st3[j];
                                          break;
                                         end;
                     end;
                   end;
   end;
   for j:=i+1 to n do
    if st[i]='?' then st[i]:='A';
   writeln(st);
   halt;
 end;
begin
 readln(st);
 n:=length(st);
 st3:='QWERTYUIOPASDFGHJKLZXCVBNM';
 if n<26  then begin
                writeln('-1');
                halt;
               end;
 st2:=copy(st,1,26);
 for i:=1 to 26 do
  begin
   if st2[i]<>'?' then begin
                       p:=pos(st2[i],st3);
                       a[p]:=a[p]+1;
                       end;
  end;
  prov;
 for i:=27 to n do
  begin
   p:=pos(st[i],st3);
   a[p]:=a[p]+1;
   p:=pos(st[i-26],st3);
   a[p]:=a[p]-1;
   if st[i-26]='?' then st[i-26]:='A';
   prov;
  end;
  writeln(-1);
end.

  var
      s:ansistring;

        b,c:array[1..100000] of longint;

          i,j,countz,countt,countv,f,vern:longint;
    begin
      readln(s);

         vern:=0;

        for i:=1 to length(s)-26+1 do begin

          for j:=1 to 26 do begin c[j]:=0; b[j]:=0; end;

            for j:=i to i+25 do
              if s[j]<>'?' then inc(b[ord(s[j])-64]);

              countz:=0;
                for j:=1 to 26 do if b[j]=0 then begin inc(countz); c[countz]:=j; end;

              countv:=0;
                for j:=i to i+25 do if s[j]='?' then inc(countv);

              countt:=0;

                for j:=1 to 26 do if b[j]>1 then inc(countt);

                if (countt=0) and (countz=countv) then begin

                      inc(vern);

                      f:=0;

                     for j:=i to i+25 do begin
                       if s[j]='?' then begin inc(f); s[j]:=chr(64+c[f]); end;

                  end;
                      break;
                end;
              end;
              if vern=0 then write(-1) else
              write(s);
            end.

var possible:boolean;
	st:string;
	sum:int64;
	i,j,k:int32;
	count:array[1..30] of int64;
Begin
	Read(st);
	possible:=False;
	If (length(st)>=26) then
		Begin
			For i:=1 to length(st)-26+1 do
				If not possible then
					Begin
						Fillchar(count,sizeof(count),0);
						Writeln(Ord('?'));
						{For j:=i to i+26 do
							Inc(count[Ord(st[j])-Ord('?')]);}
						//Writeln(Chr(65));
						{For j:=1 to Ord('Z')-Ord('?') do
							If (count[j]>0) then inc(sum);
						If (count[0]<26-sum) or (count[0]>26-sum) then possible:=False
						Else
							Begin
								For j:=i to i+26 do
									For k:=2 to Ord('Z')-Ord('?') do
										If (st[j]='?') and (count[k]=0) then
											Begin
												inc(count[k]);
												st[j]:=Chr(k+Ord('?'));
											End;
								possible:=True;
								break;
							End;}
					End;
		End;
	If possible then Writeln(st)
	Else Writeln('-1');
End.

var i,j,n,count,cc,h,wt:longint;s:ansistring;
    used:array['A'..'Z']of longint;
procedure print(t:longint);
var i:longint;j:char;
begin
        for i:=1 to t-1 do write(s[i]);
        for i:=t to t+26-1 do
        begin
             if s[i]<>'?' then write(s[i])
             else
                for j:='A' to 'Z' do
                    if used[j]<>count then begin used[j]:=count;write(j);break;end;
        end;
        for i:=t+26 to n do write(s[i]);
        wt:=1;
end;
begin
        //assign(input,'716B.inp');reset(input);
        //assign(output,'716B.out');rewrite(output);
        readln(s);
        n:=length(s);
        for i:=1 to n-26+1 do
        begin
                inc(count);h:=0;cc:=0;
                for j:=i to i+26-1 do
                    if(s[j]='?')then inc(h)
                    else if used[s[j]]<>count then
                    begin
                        used[s[j]]:=count;
                        inc(cc);
                    end;
                if cc+h=26 then begin print(i);break;end;
        end;
        if wt=0 then writeln(-1);
        close(input);close(output);
end.

var
 i,j,k,n,t,l,l1,k1:longint;
c,i1,m: qword;
 flag,flag1:integer;
s,s1,alp:ansistring;

  x:array[1..2600000] of qword;

function proverka(s:ansistring):boolean;
var alp,s1:ansistring;
i,j,l,k1:longint;
x:array[1..260000]of integer;
flag,flag1:integer;
    begin
        l:=length(s);
         flag1:=0;
    for k1:=1 to l-25 do begin
        s1:=copy(s,k1,26);
        alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        i:=1;
            //s1:=copy(s,i,26);
            flag:=1;
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to 26 do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for j:=1 to 26 do
                if x[j]=0 then flag:=0;
            if flag=1 then begin
                writeln(s1);
                flag1:=1;
            end;
    end;
        proverka:=(flag1=1);
    end;
begin
  readln(s);
///  writeln(s);
l:=length(s);
if l<26 then writeln(-1)
 else begin
    alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    i:=1;
    flag1:=0;
//    while ((i<=l)and(flag1=0)) do begin
 //       s1:=copy(s,i,26);
//        flag:=1;
//        for j:=1 to 26 do
 //           x[j]:=0;
 //       for j:=1 to 26 do begin
 //           if (s1[j]=alp[j])then x[j]:=1;
//        end;
 //       for j:=1 to 26 do
 //           if x[j]=0 then flag:=0;
//        if flag=1 then flag1:=1
//        else i:=i+1;
//    end;
//    if flag1=1 then begin
 //       while (pos('?',s)<>0) do  begin
//            i:=pos('?',s);
//            delete(s,i,1);
//            insert('A',s,i);
//        end;
//    end
 //   else begin //надо вставлять
     //   writeln(s);
    for k1:=1 to l-25 do begin
        s1:=copy(s,k1,26);
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to 26 do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for i:=1 to 26 do begin
                if (s1[i]='?') then begin
                    flag1:=0;
                    j:=1;
                    while ((j<=26)and(flag1=0)) do begin
                        if x[j]=0 then begin
                            s1[i]:=alp[j];
                            x[j]:=1;
                            flag1:=1;
                        end
                        else j:=j+1;
                    end;
                end;
            end;
        if proverka(s1) then begin
                while (pos('?',s1)<>0) do  begin
                    i:=pos('?',s1);
                    delete(s1,i,1);
                    insert('A',s1,i);
                end;
                delete(s,k1,26);
                insert(s1,s,k1);
                while (pos('?',s)<>0) do  begin
                        i:=pos('?',s);
                        delete(s,i,1);
                        insert('A',s,i);
                end;
        end;
     //   writeln(s1);
    end;
//writeln(s);
   if (proverka(s)) then
   writeln(s)
    else writeln(-1);
end;

end.

var alf,st:ansistring;
l,i,j,kol,p:longint;
a:array[0..100] of longint;
begin
  alf:='QWERTYUIOPASDFGHJKLZXCVBNM';
  readln(st);
  l:=length(st);
  for i:=1 to l do
    if st[i]<>'?' then begin
                         p:=0;
                         p:=pos(st[i],alf);
                         if a[p]=1 then begin
                                          writeln(-1);
                                          halt;
                                        end
                    else if a[p]=0 then a[p]:=1;
                       end
                  else kol:=kol+1;
  if l=26 then begin
                 if kol=0 then writeln(st)
             else begin
                    for i:=1 to l do
                      if st[i]='?' then begin
                                          for j:=1 to 26 do
                                            if a[j]=0 then begin
                                                             a[j]:=1;
                                                             break;
                                                           end;
                                          st[i]:=alf[j];
                                        end;
                    writeln(st);
                  end;
               end
else begin
       writeln(-1);
     end;
end.

{$h+}
var a:array['A'..'Z'] of longint;
    s,ss:string;
    ii:char;
    i,j,h,kol,p:longint;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output); }
readln(s);
ss:='';
for ii:='A' to 'Z' do
 ss:=ss+ii;
for i:=1 to length(s)-25 do
 begin
 for ii:='A' to 'Z' do
   a[ii]:=0;
 kol:=0;
 p:=0;
 for j:=1 to 26 do
   if s[i+j-1]='?' then inc(kol)
                   else
                        if a[s[i+j-1]]=0 then a[s[i+j-1]]:=1
                                         else begin p:=1; break; end;
  if p=0 then begin
              for j:=1 to 26 do
                if s[i+j-1]='?' then begin
                                     for ii:='A' to 'Z' do
                                       if a[ii]=0 then begin
                                                       a[ii]:=1;
                                                       write(ii);
                                                       break;
                                                       end;
                                    end
                                 else write(s[i+j-1]);
                halt;
                end;
 end;
write('-1');
{close(input);
close(output); }
end.

var
   a:array ['A'..'Z'] of longint;
   s:ansistring;
   top,i,n,h:longint;
procedure tx(i,j:longint);
   var
      f:longint;
      c:char;
   begin
   for f:=i to j do
      if s[f]='?' then
         begin
         for c:='A' to 'Z' do
            if a[c]=0 then
               begin
               delete(s,f,1);
               insert(c,s,f);
               inc(a[c]);
               break;
               end;
         end;
   for f:=1 to n do
      if s[f]='?' then
         begin
         delete(s,f,1);
         insert('A',s,f);
         end;
   h:=1;
   end;
begin
readln(s);
if length(s)<26 then writeln('-1')
else
begin
n:=length(s);
for i:=1 to 26 do
   if s[i]<>'?' then
      begin
      if a[s[i]]=1 then inc(top);
      inc(a[s[i]]);
      end;
if top=0 then tx(1,26)
else
begin
for i:=2 to length(s)-25 do
if s[i]<>'?' then
   begin
   if a[s[i]]=2 then dec(top);
   dec(a[s[i]]);
   if s[i+25]<>'?' then
      begin
      if a[s[i+25]]=1 then inc(top);
      inc(a[s[i+25]]);
      end;
   if top=0 then
      begin
      tx(i,i+25);
      break;
      end;
   end
else
   begin
   if s[i+25]<>'?' then
      begin
      if a[s[i+25]]=1 then inc(top);
      inc(a[s[i+25]]);
      end;
   if top=0 then
      begin
      tx(i,i+25);
      break;
      end;
   end;
end;
if h=1 then
   writeln(s)
else
   writeln('-1');
end;
end.

var n,m,i,j,k,ned:longint;
    f:array['A'..'Z']of longint;
    s:ansistring;
    c:char;
begin
readln(s);
if length(s)<26 then begin writeln(-1);halt;end;
for j:=1 to 26 do begin
  if s[j]<>'?' then inc(f[s[j]]) else inc(k);
end;
for i:=1 to length(s)-25 do begin
  if i>1 then begin
    if s[i-1]='?' then dec(k) else dec(f[s[i-1]]);
    if s[i+25]='?' then inc(k) else inc(f[s[i+25]]);
  end;
  ned:=0;
  for c:='A' to 'Z' do if f[c]=0 then inc(ned);
  if ned<=k then begin
    for j:=1 to 26 do begin
      if s[i+j-1]<>'?' then write(s[i+j-1]) else begin
        for c:='A' to 'Z' do if f[c]=0 then begin inc(f[c]);write(c);break;end;
      end;
    end;
    halt;
  end;
end;
writeln(-1);
end.

var
    s : ansistring;
    n, i, j : longint;
    has : array['A'..'Z'] of boolean;
    ok, flg : boolean;
    c : char;

begin
    readln(s);
    n := length(s);
    if (n < 26) then
    begin
        writeln(-1);
        exit;
    end;
    for i := 1 to n - 26 + 1 do
    begin
        fillchar(has, sizeof(has), false);
        ok := true; flg := false;
        for j := i to i + 25 do
        if (s[j] <> '?') then
        begin
            if (has[s[j]]) then
            begin
                ok := false;
                break;
            end
            else has[s[j]] := true;
        end
        else flg := true;
        if (ok) then
        begin
            if (flg) then
            begin
                for j := i to i + 25 do
                begin
                    if (s[j] = '?') then
                    begin
                        for c := 'A' to 'Z' do
                        begin
                            if not (has[c]) then
                            begin
                                has[c] := true;
                                s := copy(s, 1, j - 1) + c + copy(s, j + 1, n - j);
                                break;
                            end;
                        end;
                    end;
                end;
                for j := 1 to n do
                if (s[j] = '?') then s := copy(s, 1, j - 1) + 'A' + copy(s, j + 1, n - j);
            end;
            writeln(s);
            exit;
        end;
    end;
    writeln(-1);
end.

Var s:ansistring;
    i,j:longint; l,r,f,sc:int64;
    a:array[65..90] of int64;
    Begin
      readln(s);
      sc:=0;
      l:=1;
      r:=26;
      f:=1;
      if length(s)<26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
       a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then

       while (r+1<=length(s)) do
       begin
        f:=1;
        r:=r+1;
        l:=l+1;
        a[ord(s[l-1])]:=a[ord(s[l-1])]-1;
        a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      if f=0 then writeln(-1)
       else
        for i:=l to r do
         if not(s[i]='?') then write(s[i])
         else
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end;
      End.

label 1;
var s,s2:string;
    i,j,k,no,ko:longint;
begin
read(s);
if length(s)<26 then
begin
write(-1);
halt;
end;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
i:=1;
1: while i<=length(s)-25 do
begin
for j:=i to 25+i do
begin
if s[j]<>'?' then
begin
if pos(s[j],s2)=0 then
begin
i:=j+1;
s2:='ZXCVBNMASDFGHJKLQWERTYUIOP';
goto 1;
end;
delete(s2,pos(s[j],s2),1);
end;
end;
no:=i;
ko:=25+i;
break;
end;
if i>length(s)-25 then
begin
write(-1);
halt;
end;
{if s2='' then
begin
write(-1);
halt;
end;}
k:=1;
for i:=no to ko do
if s[i]='?' then
begin
write(s2[k]);
inc(k);
end
else write(s[i]);
end.

var
s,s1:ansistring;
a:array[1..26] of longint;
i,j,q:longint;
begin
readln(S);
//s:='ABC??FGHIJK???OPQR?TUVWXY?';

for i:=1 to length(S)-25 do begin
s1:=copy(s,i,26);
q:=0;
for j:=1 to 26 do
a[j]:=0;
for j:=1 to 26 do
if s1[j]<>'?'
then
inc(a[ord(s1[j])-64]);
for j:=1 to 26 do
if a[j]>1
then q:=1;
if q=0
then begin
for j:=i to i+25 do
if s[j]='?'
then for q:=1 to 26 do
if a[q]=0
then begin
s[j]:=chr(q+64);
inc(a[q]);
break;
end;
break;
end;
if i=length(s)-25
then begin writeln(-1);  halt;end;
end;
for i:=1 to length(S) do
if s[i]='?'
then s[i]:='A';
writeln(S);
end.

Uses math;
Var fi, fo: text;
    n, t, i, j, k: Longint;
    S: AnsiString;
    c: array[1..26] of Longint;

Begin
	assign(fi,''); reset(fi);
	assign(fo,''); rewrite(fo);
	readln(fi, S);
	n:= Length(S);
	i:= 1; j:= 2;
	if S[i]<>'?' then c[ord(S[i])-64]:= 1;
	while (i<=n) and (j<=n) do
	begin
		if S[j]<>'?' then
		begin
			if c[ord(S[j])-64]=1 then
			begin
				c[ord(S[i])-64]:= 0;
				inc(i);
			end
			else
			begin
				c[ord(S[j])-64]:= 1;
				if j-i+1=26 then break;
				inc(j);
			end;
		end
		else inc(j);
		if j-i+1>26 then inc(i);
	end;
	if j>n then
	begin
		dec(j);
		dec(i);
	end;
	randomize;
	if j-i+1=26 then
	begin
		for k:=1 to n do
			if S[k]='?' then
			begin
				if (k<i) or (k>j) then write(fo, chr(1+random(26)))
				else
					for t:=1 to 26 do
						if c[t]=0 then
						begin
							write(fo, chr(t+64));
							c[t]:= 1;
							break;
						end;
			end
			else write(fo, S[k]);
	end
	else write(fo, -1);
	close(fi); close(fo);
End.

var
    s : ansistring;
    n, i, j : longint;
    has : array['A'..'Z'] of boolean;
    ok, flg : boolean;
    c : char;

begin
    readln(s);
    n := length(s);
    if (n < 26) then
    begin
        writeln(-1);
        exit;
    end;
    for i := 1 to n - 26 + 1 do
    begin
        fillchar(has, sizeof(has), false);
        ok := true; flg := false;
        for j := i to i + 25 do
        if (s[j] <> '?') then
        begin
            if (has[s[j]]) then
            begin
                ok := false;
                break;
            end
            else has[s[j]] := true;
        end
        else flg := true;
        if (ok) then
        begin
            if (flg) then
            begin
                for j := i to i + 25 do
                begin
                    if (s[j] = '?') then
                    begin
                        for c := 'A' to 'Z' do
                        begin
                            if not (has[c]) then
                            begin
                                has[c] := true;
                                s := copy(s, 1, j - 1) + c + copy(s, j + 1, n - j);
                                break;
                            end;
                        end;
                    end;
                end;
                for j := 1 to n do
                if (s[j] = '?') then s := copy(s, 1, j - 1) + 'A' + copy(s, j + 1, n - j);
                writeln(s);
                exit;
            end;
        end;
    end;
    writeln(-1);
    exit;
end.

const fi='b.inp';
      fo='b.out';
var s:ansistring;
    i,j:longint;
    d:array['A'..'Z']of longint;
    jj:char;
    ktt:boolean;
function kt:boolean;
var j:char;
    begin
        for j:='A' to 'Z' do
            if d[j]>1 then exit(false);
        exit(true);
    end;
begin
    //assign(input,fi);reset(input);
    //assign(output,fo);rewrite(output);
    readln(s);
    for i:=1 to length(s) do
        begin
            if s[i]<>'?' then inc(d[s[i]]);
            if i>=26 then
                begin
                    if kt=true then
                        begin
                        ktt:=true;
                        for j:=i-25 to i do
                            if s[j]='?' then
                                for jj:='A' to 'Z' do
                                    if d[jj]=0 then
                                    begin
                                        inc(d[jj]);
                                        s[j]:=jj;
                                        break;
                                        end;
                        break;
                        end;
                end;
            if (i>26)and (s[i-26]<>'?') then dec(d[s[i-26]]);
        end;
    for i:=1 to length(s) do
        if s[i]='?' then s[i]:='A';
    if ktt=false then writeln(-1) else writeln(s);
end.

var
n,i,j,j1,p:longint;
st,st2,st3:ansistring;
a:array[0..100] of int64;
procedure prov;
 begin
  for j:=1 to 26 do
  begin
   if a[j]>1 then exit;
  end;
  for j:=1 to 26 do
   begin
    if a[j]=0 then begin
                    for j1:=i-25 to i do
                     begin
                      if st[j1]='?' then begin
                                          st[j1]:=st3[j];
                                          break;
                                         end;
                     end;
                   end;
   end;
   for j:=i+1 to n do
    if st[i]='?' then st[i]:='A';
   writeln(st);
   halt;
 end;
begin
 readln(st);
 n:=length(st);
 st3:='QWERTYUIOPASDFGHJKLZXCVBNM';
 if n<26  then begin
                writeln('-1');
                halt;
               end;
 st2:=copy(st,1,26);
 for i:=1 to 26 do
  begin
   if st2[i]<>'?' then begin
                       p:=pos(st2[i],st3);
                       a[p]:=a[p]+1;
                       end;
  end;
  prov;
 for i:=27 to n do
  begin
   p:=pos(st[i],st3);
   a[p]:=a[p]+1;
   p:=pos(st[i-26],st3);
   a[p]:=a[p]-1;
   if st[i-26]='?' then st[i-26]:='A';
   prov;
  end;
  writeln(-1);
end.

Var s:ansistring;
    i,j:longint; l,r,f:int64;
    a:array[65..90] of int64;
    Begin
      readln(s);
      l:=1;
      r:=26;
      f:=1;
      if length(s)<26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
      if s[i]<>'?' then a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then

       while (r+1<=length(s)) do
       begin
        f:=1;
        r:=r+1;
        l:=l+1;
        a[ord(s[l-1])]:=a[ord(s[l-1])]-1;
        a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      if f=0 then writeln(-1)
       else
        for i:=1 to length(s) do
         if (i>=l) and (i<=r) then begin
         if not(s[i]='?') then write(s[i])
         else
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end; end
             else if not(s[i]='?') then write(s[i]) else write('A');
      End.

var a:array['A'..'Z']of longint;
n,i,l,r:longint;
s,ans:ansistring;
c:char;
b:boolean;

procedure finish;
begin
for i:=l to r do
if s[i]='?'then
for c:='A' to 'Z' do
if a[c]=0 then begin a[c]:=1; s[i]:=c; break; end;
writeln(s);
halt;
end;

begin
ans:='';
readln(s);
n:=length(s);
for c:='A' to 'Z' do a[c]:=0;
if n<26 then
begin
write(-1);
halt;
end;
l:=1;
r:=26;
while r<=n do
begin
for c:='A' to 'Z' do a[c]:=0;
b:=true;
for i:=l to r do
if s[i]<>'?' then
begin
inc(a[s[i]]);
if a[s[i]]=2 then begin l:=l+1; r:=l+25; b:=false; break; end;
end;
if b then finish;
end;
write(-1);
end.

var x:char;
    flag:array[1..26] of boolean;
	ch:array[1..60000] of char;
	i,j,ans,now,n:longint;
begin
  fillchar(flag,sizeof(flag),false);
  now:=0;
  n:=0;
  while not(eoln) do
  begin
    read(x);
    inc(n);
    ch[n]:=x;
    if (x='?') then inc(now) else flag[ord(x)-64]:=true;
  end;
  readln;
  ans:=0;
  for i:=1 to 26 do
	if not(flag[i]) then inc(ans);
  if (ans<now) then writeln('-1') else
  begin
    now:=1;
    for i:=1 to n do
		if (ch[i]<>'?') then write(ch[i]) else
		begin
		  while (now<=25) and flag[now] do inc(now);
		  flag[now]:=true;
		  write(chr(now+64));
		end;
	writeln;
  end;
end.

var possible:boolean;
	st:string;
	sum:int64;
	i,j,k:int32;
	count:array[0..30] of int64;
Begin
	Read(st);
	possible:=False;
	If (length(st)>=26) then
		Begin
			For i:=1 to length(st)-26+1 do
				Begin
					sum:=0;
					Fillchar(count,sizeof(count),0);
					For j:=i to i+25 do
						Inc(count[Ord(st[j])-Ord('?')]);
					For j:=1 to Ord('Z')-Ord('?') do
						If (count[j]>0) then inc(sum);
					If (count[0]>=26-sum) then
						possible:=True;
					For j:=i to i+25 do
						For k:=2 to Ord('Z')-Ord('?') do
							If (st[j]='?') and (count[k]=0) then
								Begin
									inc(count[k]);
									st[j]:=Chr(k+Ord('?'));
								End;
				End;
		End;
	If possible then Writeln(st)
	Else Writeln('-1');
End.

var i,j,n,count,cc,h,wt:longint;s:ansistring;
    used:array['A'..'Z']of longint;
procedure print(t:longint);
var i:longint;j:char;
begin
        for i:=1 to t-1 do write(s[i]);
        for i:=t to t+26-1 do
        begin
             if s[i]<>'?' then write(s[i])
             else
                for j:='A' to 'Z' do
                    if used[j]<>count then begin used[j]:=count;write(j);break;end;
        end;
        for i:=t+26 to n do write(s[i]);
        wt:=1;
end;
begin
        //assign(input,'716B.inp');reset(input);
        //assign(output,'716B.out');rewrite(output);
        readln(s);
        n:=length(s);
        for i:=1 to n-26+1 do
        begin
                inc(count);h:=0;cc:=0;
                for j:=i to i+26-1 do
                    if(s[j]='?')then inc(h)
                    else if used[s[j]]<>count then
                    begin
                        used[s[j]]:=count;
                        inc(cc);
                    end;
                if cc+h=26 then begin print(i);break;end;
        end;
        if wt=0 then writeln(-1);
        close(input);close(output);
end.

var
 i,j,k,n,t,l,l1,k1:longint;
c,i1,m: qword;
 flag,flag1:integer;
s,s1,alp:ansistring;

  x:array[1..2600000] of qword;

function proverka:boolean;
var alp,s1:ansistring;
i,j,l,k1:longint;
x:array[1..260000]of integer;
flag,flag1:integer;
    begin
        l:=length(s);
         flag1:=0;
    for k1:=1 to l-26 do begin
        s1:=copy(s,k1,26);
        alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
        i:=1;

            //s1:=copy(s,i,26);
            flag:=1;
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to 26 do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for j:=1 to 26 do
                if x[j]=0 then flag:=0;
            if flag=1 then flag1:=1;
    end;
        proverka:=(flag1=1);
    end;
begin
  readln(s);
///  writeln(s);
l:=length(s);
if l<26 then writeln(-1)
 else begin
    alp:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    i:=1;
    flag1:=0;
//    while ((i<=l)and(flag1=0)) do begin
 //       s1:=copy(s,i,26);
//        flag:=1;
//        for j:=1 to 26 do
 //           x[j]:=0;
 //       for j:=1 to 26 do begin
 //           if (s1[j]=alp[j])then x[j]:=1;
//        end;
 //       for j:=1 to 26 do
 //           if x[j]=0 then flag:=0;
//        if flag=1 then flag1:=1
//        else i:=i+1;
//    end;
//    if flag1=1 then begin
 //       while (pos('?',s)<>0) do  begin
//            i:=pos('?',s);
//            delete(s,i,1);
//            insert('A',s,i);
//        end;
//    end
 //   else begin //надо вставлять
     //   writeln(s);
    for k1:=1 to l-26 do begin
        s1:=copy(s,k1,26);
            for j:=1 to 26 do
                x[j]:=0;
            for i:=1 to l do begin
                for j:=1 to 26 do begin
                    if (s1[i]=alp[j]) then x[j]:=1;
                end;
            end;
            for i:=1 to l do begin
                if (s1[i]='?') then begin
                    flag1:=0;
                    j:=1;
                    while ((j<=26)and(flag1=0)) do begin
                        if x[j]=0 then begin
                            s1[i]:=alp[j];
                            x[j]:=1;
                            flag1:=1;
                        end
                        else j:=j+1;
                    end;
                end;
            end;

            while (pos('?',s)<>0) do  begin
                i:=pos('?',s1);
                delete(s1,i,1);
                insert('A',s1,i);
            end;
        delete(s,k1,26);
        insert(s1,s,k1);
        while (pos('?',s)<>0) do  begin
                i:=pos('?',s);
                delete(s,i,1);
                insert('A',s,i);
            end;
    end;
//writeln(s);
   if (proverka) then
   writeln(s)
    else writeln(-1);
end;

end.

Var s:ansistring;
    sc,l,r,i,j,f:longint;
    a:array[65..90] of longint;
    Begin
      readln(s);
      sc:=0;
      l:=1;
      r:=26;
      f:=1;
      if length(s)<26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
       if s[i]='?' then sc:=sc+1
        else a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then begin

       while (r+1<=length(s)) do
       begin

        f:=1;
        r:=r+1;
        l:=l+1;
        if s[l]='?' then sc:=sc-1
         else a[ord(s[l])]:=a[ord(s[l])]-1;
        if s[r]='?' then sc:=sc+1
         else a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      for j:=65 to 90 do
        if a[j]>1 then f:=0;
      end;
      if f=0 then writeln(-1)
       else
        for i:=l to r do
         if s[i]='?' then
         begin
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end; end
            else write(s[i]);
      End.

   //  ABCDEFGHIJKLMNOPQRSTUVWXYZ
   // AA?????????????????????????A
   //ABCDEFGHIJKLMNOPQRSTUVWXYZA

Var s:ansistring;
    i,j:longint; l,r,f:int64;
    a:array[65..90] of int64;
    Begin
      readln(s);
      l:=1;
      r:=26;
      f:=1;
      if length(s)<>26 then begin writeln(-1); exit; end;
      for i:=1 to 26 do
      if s[i]<>'?' then a[ord(s[i])]:=a[ord(s[i])]+1;
       for j:=65 to 90 do
         if a[j]>1 then f:=0;
       if f=0 then

       while (r+1<=length(s)) do
       begin
        f:=1;
        r:=r+1;
        l:=l+1;
        a[ord(s[l-1])]:=a[ord(s[l-1])]-1;
        a[ord(s[r])]:=a[ord(s[r])]+1;
        for j:=65 to 90 do
         if a[j]>1 then f:=0;

        if f=1 then break;
       end;
      if f=0 then writeln(-1)
       else
        for i:=l to r do
         if not(s[i]='?') then write(s[i])
         else
           for j:=65 to 90 do
            if a[j]=0 then begin a[j]:=1; write(chr(j)); break; end;
      End.