public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个字符串:");
String str = sc.next();
if(str.contains("b")){
str =str.replaceAll("b", "");
if(str.contains("ac")){
str =str.replaceAll("ac", "");
}
}
System.out.println(str);
} |