i have a string. I need to replace the character '?' and find the missing character to make it lexicographical string. for Example- if I have string "ab". Its lexicographical value is "aa".Since the first character 'a' is different than second character 'b'. It gives output -1. If I give string "ta?a". In this string If I replace '?' with t. It become lexicographical. It gives output "tata". I am giving input s and k. K is half of length of s. Please help me in this code.
s=input()
k=input()
for i in range(k):
if (s[i]>=97) and (s[i]<=123):
if (s[i]==s[i+k]):
continue
else:
s=-1
else:
if(s[i]>=s[i+k]):
s[i+k]=s[i]
else:
s[i]=s[i+k]
return s