题解 | #删除公共字符串(A组)#
删除公共字符(A组)
https://ac.nowcoder.com/acm/contest/71300/C
首先分别定义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))
查看18道真题和解析