Advertisement
YavorGrancharov

Censor_Email_Address

Jan 4th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import com.sun.deploy.util.StringUtils;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Censor_Email_Address {
  6.     public static void main(String[] args) {
  7.         Scanner console = new Scanner(System.in);
  8.  
  9.         String line = console.nextLine();
  10.         String text = console.nextLine();
  11.         String[] arr = line.split("\\@");
  12.         String name = arr[0];
  13.  
  14.         if (text.contains(line)) {
  15.             String censored = line.replace(name, "*");
  16.             text = text.replaceAll(line,censored);
  17.         }
  18.         System.out.println(text);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement