class Solution {public:ListNode* ReverseList(ListNode* pHead) {if(pHead==NULL)return NULL;ListNode* temp=pHead->next;ListNode* p=pHead;while(temp!=NULL){pHead->next=temp->next;temp->next=p;p=temp;temp=pHead->next;}return p;}};