struct ListNode* reverseList(struct ListNode* head){
struct ListNode*p = NULL;
struct ListNode*pre = NULL;
while(head!=NULL)
{
p = head->next;
head->next = pre;
pre = head;
head = p;
}
return pre;
}