ListNode* reverseList(ListNode* head) {
stack<int> s;
ListNode* t=head;
while(t!=NULL)
{
s.push(t->val);
t=t->next;
}
t=head;
while(t!=NULL)
{
t->val = s.top();
s.pop();
t=t->next;
}
return head;