Programming

[dovelet]-crypt

xer0s 2014. 1. 20. 19:18

// 공백+대문자 기능 없음


#include <stdio.h>

#include <string.h>


void findplace(char encrypt[], char plane[], int place[], int len)

{

int i, j;

for(i=0; i<len; i++)

{

for(j=0; j<53; j++)

{

if(encrypt[i] == plane[j])

{

place[i] = j;

}

}

}

}


int main(void)

{

int k;

char key[27];

char encrypt[80];

char plane[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

int place[80];

int len;


scanf("%s", key);

scanf("%s", encrypt);


len = strlen(encrypt);

findplace(encrypt, plane, place, len);

for(k=0; k<len; k++)

{

printf("%c", key[place[k]]);

}


return 0;

}