#include<stdio.h>
#include<ctype.h>
#include<math.h>
#include<malloc.h>

//#define NULL (struct stack *)0 

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 is\n\n");

while(list1->next!= NULL)
{
printf("%c",list1->value);
list1=list1->next;
}

printf("\n");
return(0);
}


