Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.sun.deploy.util.StringUtils;
- import java.util.Scanner;
- public class TextFilter {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String[] banWords = scanner.nextLine().split("[, ]");
- String input = scanner.nextLine();
- for (String word:banWords) {
- input = input.replace(word, StringUtils.repeat("", word.length(), '*');
- }
- System.out.println(input);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment