LardaX

TextFilterQuestion

Oct 28th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. import com.sun.deploy.util.StringUtils;
  2. import java.util.Scanner;
  3.  
  4. public class TextFilter {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         String[] banWords = scanner.nextLine().split("[, ]");
  9.         String input = scanner.nextLine();
  10.  
  11.         for (String word:banWords) {
  12.             input = input.replace(word, StringUtils.repeat("", word.length(), '*');
  13.          
  14.         }
  15.         System.out.println(input);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment