#include<stdio.h>
#include<ctype.h>
#include<math.h>
#include<malloc.h>

char c;

struct node
{
char value;
struct node *next;
};

struct node *list=NULL;
struct node *list1=NULL;
struct node *tptr=NULL;

int main(void)
{

printf("\nEnter the string(enter $ when finished)\n");

tptr=malloc(sizeof(struct node));
list=tptr;
c=getchar();
list->value=c;
list1=list;

do
{
c=getchar();
tptr=malloc(sizeof(struct node ));
list->next=tptr;
tptr->value=c;
tptr->next=NULL;
list=tptr;

}while(c!='$');


/*
printf("\nThe string after deleting d is\n\n");

while(list1->value!='$')
{
if(list1->value=='d')
list1=list1->next;
else
{
printf("%c",list1->value);
list1=list1->next;
}
}
*/

printf("\nThe string after replacing d by b is\n\n");

while(list1->value!='$')
{
if(list1->value=='d')
{
list1->value='b';
printf("%c",list1->value);
list1=list1->next;
}
else
{
printf("%c",list1->value);
list1=list1->next;
}
}





return(0);
}


