#include <stdio.h> #define len sizeof(struct a) #define NULL 0
struct a {char lk; struct a *next ; };
main() {struct a *head,*p,*q,*r; int i; char ch;
head=p=(struct a *) malloc(len);
for(i=1;i<=26;i++) {(p->lk)=('a'+i-1); p->next=(struct a *)malloc(len); p=p->next;
} p->next=NULL; p=head;
while (p->next != NULL)
{ printf("%c ",p->lk); p=p->next; } printf("\n");
printf("input deleted zimu:");
scanf("%c",&ch); p=head; while(ch != '0') { if(head->lk==ch) {head=head->next; free(p); } else
while((p->lk != ch) && (p->next != NULL)) { q=p; p=p->next; }
if(p->lk==ch) {q->next=p->next; free(p);}
printf("\n"); p=head; while(p->next != NULL) {printf("%c ",p->lk); p=p->next; } printf("\n"); printf("input deleted zimu:"); scanf("%c",&ch);
} }