Please see here
I can tell you only pseudo code
Here it is:
If there is no question mark
print -1
If there is a question mark and all the alphabets have been used then again
print -1
else if there is a question mark and all the alphabets have not been used and you can fill those without repeating any of them then
print random alphabets
Happy Coding!