package com.heynt.permutation.main;

import java.util.List;
import java.util.Map;

import com.heynt.permutation.utils.Encrypt;
import com.heynt.permutation.utils.Handler;

public class Main
{
    public static void main( String[] args )
    {
        Handler inputHandler = Handler.getInstance();

        String plaintext = inputHandler.getNewInputFromStdin();
        inputHandler.validateUserInput(plaintext);

        // keyMap defines how plaintext letters map to ciphertext
        // TODO We could add different mappings as case statements in the getKeyMap method
        Map<Character, List<Integer>> keymap = inputHandler.getKeyMap(1);

        Encrypt encryptor = new Encrypt();
        String cipherText = encryptor.EncryptString(plaintext, keymap);

        // Display the encrypted message
        if (cipherText != null)
        {
            System.out.println("The encrypted message is: ");
            System.out.println(cipherText);
        }

        System.exit(0);
    }
}

@@ -30,16 +30,72 @@
 .main;%0A%0A
+import java.text.Collator;%0Aimport java.util.Collection;%0A
 import j
@@ -130,16 +130,42 @@
 til.Map;
+%0Aimport java.util.TreeSet;
 %0A%0Aimport
@@ -1035,16 +1035,134 @@
        %7D
+%0A        // sorted alphabetically%0A        Collection%3CString%3E dictionary = new TreeSet%3CString%3E(Collator.getInstance());
 %0A%0A      

read in a all english words