I have a program where I have encrypt or decrypt a file. The keyword is a user-entered string but any repeating letters have to be removed.
For example, FEATHER
would become FEATHR
.
I currently have the following application as a starting point, but I don't know how to remove the duplicate letters. What do I need to change or add?
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class Average
{
public static void main(String[] args) throws FileNotFoundException
{
System.out.print("Would you like to encrypt or decrypt. e/d");
Scanner ed = new Scanner (System.ed);
String eOrD = ed.next();
if (eOrD.equals("e"))
{
Scanner console = new Scanner(System.in);
System.out.print("Output File: ");
String outputFileName = console.next();
PrintWriter out = new PrintWriter(outputFileName);
System.out.print("Please enter an encryption key");
String keyWord = in.next();