#include<stdio.h>
#include<ctype.h>
#include<math.h>
#include<malloc.h>

//#define NULL (struct node *)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");


while((c=getchar())!='$')
{
struct node *tptr;
tptr=malloc(sizeof(struct node));

tptr->value=c;
tptr->next=list;
list=tptr;
}

printf("\nThe reverse string is\n\n");

while(list!= NULL)
{
printf("%c",list->value);
list=list->next;
}

printf("\n");
return(0);
}


