title: How do I change my encryption code so that it will only encrypt the given string, and not encrypt what was previously encrypted?
body: <p>My code encrypts the previously encrypted phrase in an inputted sentence. I want it so that it encrypts only the letters v, m, g, and b in the <strong>original</strong> string, not the previously encrypted letters, if that makes any sense. So with a string such as "Very good", it would encrypt the letter v into the correct phrase, but then it would find the letter 'b' within that encrypted phrase, then further encrypt it, which is want I don't want. And obviously the decryption wouldn't work as well, because it needs the specific phrase to turn it back into the correct letter, but it can't because the phrase has been encrypted even further than it should have.</p>
  
  <p>I've tried to change the order of what letter gets encrypted first, hoping that it would avoid conflicts, but that hasn't worked at all.</p>
  
  <p><em>Crypto Class</em></p>
  
  <pre><code>public String encryptdSntnc;
  public String decryptdSntnc;
  public String sntnc;
  public String encrypt(String sntnc)
  {
      String encrypt1 = sntnc.replace("v", "ag',r");
      String encrypt2 = encrypt1.replace("V", "ag',r");
      String encrypt3 = encrypt2.replace("m", "ssad");
      String encrypt4 = encrypt3.replace("M", "ssad");
      String encrypt5 = encrypt4.replace("g", "jeb..w");
      String encrypt6 = encrypt5.replace("G", "jeb..w");
      String encrypt7 = encrypt6.replace("b", "dug&gt;?/");
      encryptdSntnc = encrypt7.replace("B", "dug&gt;?/");
      return encryptdSntnc;
  }
  
  public String decrypt(String encryptdSntnc)
  {
      String decrypt1 = encryptdSntnc.replace("dug&gt;?/", "B");
      String decrypt2 = decrypt1.replace("dug&gt;?/", "b");
      String decrypt3 = decrypt2.replace("jeb..w", "G");
      String decrypt4 = decrypt3.replace("jeb..w", "g");
      String decrypt5 = decrypt4.replace("ssad", "M");
      String decrypt6 = decrypt5.replace("ssad", "m");
      String decrypt7 = decrypt6.replace("ag',r", "V");
      decryptdSntnc = decrypt7.replace("ag',r", "v");
      return decryptdSntnc;
  }
  </code></pre>
  
  <p><em>Tester Class</em></p>
  
  <pre><code>    Scanner kbReader = new Scanner(System.in);
      System.out.print("Enter a sentence that is to be encrypted: ");
      String sntnc = kbReader.nextLine();
  
      Crypto myCryptObj = new Crypto();
      String encryptdSntnc = myCryptObj.encrypt(sntnc);
      System.out.println("Encrypted sentence = " + encryptdSntnc);
  
      String decryptdSntnc = myCryptObj.decrypt(encryptdSntnc);
      System.out.println("Decrypted sentence = " + decryptdSntnc);
  </code></pre>
  
  <p>What I expect is if you type in "Very good", the encrypted sentence would be "ag',rery jeb..wood", and the decrypted sentence would be "Very good". </p>
  
  <p>But instead, I get "ajedug>?/..w',rery jedug>?/..wood" for the encryption, and "ajeB..w',rery jeB..wood" for the decryption, using the same "Very good". </p>