#include
#include
typedef struct node
{ char ch;
struct node *forward; /* Link to next node. */
struct node *backward;/* Link to previous node.*/
} CODE;
int strlen(char *s)
{ int len = 0;
while (*s++ != '\0' )
len++;
return( len );
}
char *decode(char *old,int key)
{ char *New; int length,count,i;
CODE *loop,*p;
length=strlen(old);
loop=(CODE *) malloc( length*sizeof(CODE) );
for ( i = 1;i
{ loop[i].forward = &loop[i+1];
___(1)___
}
loop[0].backward = &loop[length-1];
loop[0].forward = &loop[1];
loop[length-1].forward = loop;
___(2)___
for ( p = loop,i = 0;i
{ for ( count = 1;count
p= p->forward ;
___(3)___
p->backward->forward = p->forward ;
p->forward->backward = p->backward ;
___(4)___
}
New = ( char *)malloc( ( length+1 ) *sizeof(char) );
for ( i=0;i
___(5)___
New[length]='\0';
return (New);
}
void main()
{ char old[256];