遍历两次字符串

from collections import defaultdict

while True:
	try:
		s = input()
		d = defaultdict(int)
		for c in s:
			d[c] += 1
		flag = False
		for c in s:
			if d[c] == 1:
				flag = True
				print(c)
				break
		if flag == False:
			print(-1)
	except:
		break