Escreve um programa o mais pequeno possível para decifrar mensagens. Podes usar C, C++, Java, Perl, Python3, Ruby 2.3.1, Pascal ou Haskell.
O teu objetivo é descodificar mensagens cifradas utilizando um método de dupla cifra. O método de cifrar é o seguinte:
- Removem-se todas as letras duplicadas da chave;
- Adiciona-se ao fim da chave as letras do alfabeto que faltam;
- Faz-se corresponder a cada letra da chave um número começando no valor;
- No fim disto temos uma tabela com o primeiro passo da substituição;
- Usando esta tabela, cifra-se o texto;
- Para criar a segunda tabela de substituição, usa-se como chave os algarismos do 0 ao 9, fazendo corresponder a cada algarismo vários valores preenchendo da esquerda para a direita;