s=input()
s1=[] # 去重,不改变字母出现的顺序
for i in range(len(s)):
if s[i] not in s1:
s1.append(s[i])
#print(s1)
for i in s1:
if s.count(i)==1:
print(i)
break
else:
print(-1)

s=input()
s1=[] # 去重,不改变字母出现的顺序
for i in range(len(s)):
if s[i] not in s1:
s1.append(s[i])
#print(s1)
for i in s1:
if s.count(i)==1:
print(i)
break
else:
print(-1)