title: Remove all characters from String1 which are present in String2 and vice versa
body: <p>I am new to stackoverflow and this is my first question on stackoverflow.</p>
  
  <p>I've a below question in my mind:</p>
  
  <p>Print the value of Output1 and Output2 in such a way that, Output1 should print all the characters present in String1 but not in String2 and Output2 should print all the characters present in String2 but not in String1.</p>
  
  <p>Example:
  If String1: ABC and String: BC then Output1: A and Output2:</p>
  
  <p>If String1: BC and String: BANGALORE then Output1: C and Output2: ANGALORE</p>
  
  <p>I know this question looks similar to <a href="https://stackoverflow.com/questions/38430262/remove-characters-from-the-second-string-which-are-present-in-the-first-string">Remove characters from the second string which are present in the first string</a> and <a href="https://stackoverflow.com/questions/33839755/given-two-strings-str1-and-str2-as-input-remove-all-chars-from-str1-that-appea">Given two strings, str1 and str2 as input, remove all chars from str1 that appear in str2</a>
  but here I want to get the result of String1 and String2 as two different strings Output1 and Output2</p>
  
  <p>I've tried below program to achieve this but not sure if this is a good solution or not as I am taking four for loops to get the result.</p>
  
  <pre><code>package com.test.java.program;
  import java.util.Scanner;
  public class PrintString {
  
      public static void main(String[] args) {
  
          Scanner scanner = new Scanner(System.in);
  
          System.out.println("Enter first input as a string: ");
          String str1 = scanner.nextLine();
  
          System.out.println("Enter first input as a string: ");
          String str2 = scanner.nextLine();
  
          System.out.println(printStringOutput(str1, str2));
      }
  
      private static String printStringOutput(String str1, String str2){
  
          String strTemp1 = str1;
  
          int strLen1 = str1.length();
          int strLen2 = str2.length();
  
          for(int i=0; i&lt;strLen1; i++){
  
              for(int j=0; j&lt;strLen2; j++){
  
                  if(str1.charAt(i) == (str2.charAt(j))){
                      str1 = str1.replace(str1.charAt(i), '\u0000');
                  }
              }
          }
  
          for(int i=0; i&lt;strLen2; i++){
  
              for(int j=0; j&lt;strLen1; j++){
  
                  if(str2.charAt(i) == (strTemp1.charAt(j))){
                      str2 = str2.replace(str2.charAt(i), '\u0000');
                  }
              }
          }
  
          return "Output1: " + str1 + "\nOutput2: " + str2;
      }
  }
  </code></pre>
  
  <p>I know we can achieve the same result using regex expression as well but not sure how to do it. Could someone please provide a better solution for this question.</p>
  
  <p>I am assuming given inputs are Strings and not performing any validations on inputs.</p>
  
  <p>Thanks.</p>