題目
題解 Java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str1 = br.readLine();
String str2 = br.readLine();
for (int i = 0; i < str2.length(); i++) {
str1 = str1.replaceAll(str2.charAt(i) + "", "");
}
str1=str1.toUpperCase();
StringBuilder sb = new StringBuilder(str1);
for (int i = 0; i < sb.length(); i++) {
for (int j = i+1; j < sb.length(); j++) {
if (sb.charAt(i) == sb.charAt(j)) {
sb.deleteCharAt(j);
j--;
}
}
}
System.out.println(sb);
}
}