两个for循环可以减少内存
a=input()
b=input()
k=''
for i in a:
if i not in k :
k+=i
for i in b:
if i not in k:
k+=i
print("".join(k))
这样的方法看起来短但是多向内存申请了一个空间s=a+b,然而for循环的时间和上面两个循环的时间是一致的。
a=input()
b=input()
s=a+b
k=''
for i in s:
if i not in k:
k+=i
print(k)