I was able to make a letter entered by the user show another
Example: c returns A, since the letter A is the most often used in our alphabet. So I can unveil a message for example, because in the message the letter that comes out most is C, then C turned A.
Only you have letters that have the same number of times that repeat, for example j, g with 10 each. The question is how to assign the letter j and then g, like a weight to one of them.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
main()
{
char chave[26],texto[30],frase[30];
int cont,i;
printf("Digite o texto: ");
scanf("%s",chave);
cont=strlen(chave);
strcpy(texto, chave);
for(i=0;i<cont;i++)
{
if (texto[i]=='c')
frase[i]='a';
else if (texto[i]=='z')
frase[i]='e';
else if (texto[i]=='s')
frase[i]='o';
else if (texto[i]=='m')
frase[i]='r';
else if (texto[i]=='n')
frase[i]='n';
else if (texto[i]=='e')
frase[i]='z';
else if (texto[i]=='j')
frase[i]='d';
else if (texto[i]=='a')
frase[i]='w';
else frase[i]=texto[i];
}
printf("\n %s\nTexto Descriptografada e :\n %s\n", chave, frase);
}