#include <iostream>
#include <unordered_set>
#include <string>
using namespace std;
string removeCharacters(const string& s1, const string& s2) {
unordered_set<char> charsToRemove(s2.begin(), s2.end());
string result;
for (char c : s1) {
if (charsToRemove.find(c) == charsToRemove.end()) {
result += c; // 只添加不在s2中的字符
}
}
return result;
}
int main() {
string s1, s2;
getline(cin, s1);
getline(cin, s2);
cout << removeCharacters(s1, s2) << endl; // 输出结果
return 0;
}
import java.util.HashSet;
import java.util.Scanner;
public class Main {
public static String removeCharacters(String s1, String s2) {
HashSet<Character> charsToRemove = new HashSet<>();
for (char c : s2.toCharArray()) {
charsToRemove.add(c);
}
StringBuilder result = new StringBuilder();
for (char c : s1.toCharArray()) {
if (!charsToRemove.contains(c)) {
result.append(c); // 只添加不在s2中的字符
}
}
return result.toString();
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String s1 = sc.nextLine();
String s2 = sc.nextLine();
System.out.println(removeCharacters(s1, s2)); // 输出结果
sc.close();
}
}
def remove_characters(s1, s2):
# 使用集合提高查找效率
chars_to_remove = set(s2)
result = ''.join([char for char in s1 if char not in chars_to_remove])
return result
if __name__ == "__main__":
s1 = input().strip()
s2 = input().strip()
print(remove_characters(s1, s2))