/**
 * struct ListNode {
 *	int val;
 *	struct ListNode *next;
 * };
 */

/**
 * 
 * @param pHead ListNode类 
 * @return ListNode类
 */
struct ListNode* ReverseList(struct ListNode* pHead ) {
    // write code here
    struct ListNode *temp1 = NULL,*temp2 = pHead,*temp3 = pHead->next;
    if(NULL == pHead || NULL == pHead->next)    return pHead;
    while(NULL != temp3)
    {
        temp2->next = temp1;
        temp1 = temp2;
        temp2 = temp3;
        temp3 = temp2->next;
    }
    temp2->next = temp1;
    return temp2;
}