需要自己写过滤内容
package hhh.guoluqi;
import java.util.Scanner;
public class ceshi {
//我tm你个大sb
public static void main(String[] args) {
System.out.println("输入:");
String s = new Scanner(System.in).next();
String[] sens = new String[]{"sb","我靠","操你妈","tm","傻逼"};
for (String word : sens) {
if (s.contains(word)){
int num = word.length();
String cont = "*";
for (int j = 0; j < num-1; j++) {
cont += "*";
}
s = s.replace(word,cont);
}
}
System.out.println(s);
}
}
运行结果