try: while(True): first = list(input()) second = set(input()) result = "" for x in first: if x not in second: result = result + x print(result) except: pass好久没写python代码,语法快忘了:(
#! python3 #-*- coding:utf-8 -*- """ 题目描述 输入两个字符串,从第一字符串中删除第二个字符串中所有的字符。 例如,输入”They are students.”和”aeiou”,则删除之后的第一个字符串变成”Thy r stdnts.” 输入描述: 每个测试输入包含2个字符串 输出描述: 输出删除后的字符串 示例1 输入 They are students. aeiou 输出 Thy r stdnts. """ import sys def clean_str(str1,str2): "" for i in str2: str1=str1.replace(i,'') return str1 if __name__=="__main__": "" str1=input() str2=input() print(clean_str(str1,str2))