输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。例如,输入”They are students.”和”aeiou”,则删除之后的第一个字符串变成”Thy r stdnts.”
输入描述:
每个测试输入包含2个字符串
输出描述:
输出删除后的字符串
输入例子:
They are students. aeiou
输出例子:
Thy r stdnts.
用字典存储第二个字符串,减少时间消耗。一组测试数据
import sys
try:
line1 = sys.stdin.readline().strip()
line2 = sys.stdin.readline().strip()
dir = dict()
for x in line2:
dir[x] = dir.get(x, 0) + 1
st = ""
for x in line1:
if x not in dir.keys():
st += x
print st
except:
pass