while True:
try:
s = input()
for i in s:
if s.count(i) == 1:
print(i)
break
else:
print('-1')
except:
break
while True:
try:
s = input()
for i in s:
if s.count(i) == 1:
print(i)
break
else:
print('-1')
except:
break