#include #include #include #define MAX_SIZE 100 int move_to_front(char *str,char c) { char *q,*p; int shift=0; p=(char *)malloc(strlen(str)+1); strcpy(p,str); q=strchr(p,c); //returns pointer to location of char c in string str shift=q-p; // no of characters from 0 to position of c in str strncpy(str+1,p,shift); str[0]=c; free(p); // printf("\n%s\n",str); return shift; } void decode(int* pass,int size,char *sym) { int i,index; char c; char table[]="abcdefghijklmnopqrstuvwxyz"; for(i=0;i