First off, sorry the tittle is super descriptive, but I honestly couldn't come up with a way to explain my issue in one sentence.
To explain what I'm doing: I am creating an alphabet that has a key at the beginning for mono alphabetic encryption. I made a method that removed duplicates which works fine. I have some extra time for this assingment so I have been playing around. I discovered Sets, which don't contain duplicates.

So when I have the Set return to a string, I have a string that reads

> 
> [s, e, c, u, r.....x, y, z]
> 
> 
> 

The string has all these characters in it I don't need. So I use a method I wrote that removes anything thats not a letter. When I call it the first time, I get

> 
> s e c u r....x y z
> 
> 
> 

I, just for fun, call the method again. I am now left with

> 
> secur....xyz
> 
> 
> 

So if any one can tell me why the method is successful in removing the commas and the brackets the first time but not the spaces yet removes the spaces in a second call, that would be awesome.
For reference, my code

```
public static String createMonoAlphabet(String key){
    String crypticAlphabet = key;       
    crypticAlphabet = crypticAlphabet.concat("abcdefghijklmnopqrstuvwxyz");
    //crypticAlphabet = removeDuplicates(crypticAlphabet);
    Set alphabet = new LinkedHashSet();
    for(int i = 0; i<crypticAlphabet.length(); i++){
        alphabet.add(crypticAlphabet.charAt(i));
    }

    crypticAlphabet = alphabet.toString();
    crypticAlphabet = parseInput(crypticAlphabet);
    crypticAlphabet = parseInput(crypticAlphabet);
    return crypticAlphabet;
}        

```

That is the method that uses the set. As a note, I've never used them before I'm just playing around here so if its bad practice or something thats fine. Feel free to let me know, but I'm not as concerned about that right now
And now for the method that removes non letters 

```
    public static String parseInput(String input){
    StringBuffer buf = new StringBuffer(input);

    for(int i = 0; i < buf.length(); i++){
        char c = buf.charAt(i);
        if(!(((int)c >= 65 && (int)c <= 90) || 
                ((int)c >= 97 && (int)c <= 122))){
            System.out.print(buf.charAt(i));
            buf =  buf.deleteCharAt(i);
        }   
    }
    System.out.print(".");
    System.out.println();
    input = buf.toString();
    return input;
}

```