首先分别定义s1和s2来代表两个字符串
然后使用set把s2拆分
使用for循环遍历,如果不在s2中就插入数组
最后组合一下输出
s1 = input()
s2 = input()
ans = []
nend_remove = set(s2)
for i in s1:
if not i in need_remove:
ans.append(i)
print(''.join(ans))
首先分别定义s1和s2来代表两个字符串
然后使用set把s2拆分
使用for循环遍历,如果不在s2中就插入数组
最后组合一下输出
s1 = input()
s2 = input()
ans = []
nend_remove = set(s2)
for i in s1:
if not i in need_remove:
ans.append(i)
print(''.join(ans))