Node* front(Node* head,int key){
Node* temp=new Node(key);
if(head==NULL){
head=temp;
return head;
}
temp->next=head;
return temp;
}
struct Node* reverseList(struct Node *root)
{
Node* head=NULL;
while(root!=NULL)
{
head=front(head,root->data);
root=root->next;
}
return head;
}