- 刚开始的dummynode一定不要声明成指针类型。 
 - cur用来链接链表。 
 - head用来做备份,并且操作的就是head 
 - head->next->val 之类的操作出来的时候,记得 head->next 不为空。 
 - 要注意一些head = head->next 是可同时处理很多事情的。 
 
 /*
struct ListNode {
    int val;
    struct ListNode *next;
    ListNode(int x) :
        val(x), next(NULL) {
    }
};
*/
class Solution {
public:
    map<int,ListNode*> mp;
    ListNode* deleteDuplication(ListNode* pHead) {
        ListNode node(0);
        ListNode* cur = &node;
        ListNode* head = pHead;
        while(head){
            if(head->next== NULL || head->val != head->next->val){//避免下一个节点相等,并且到最后一个节点的时候进来。
                cur->next = head;
                cur = cur->next;
            }
            while(head->next!=NULL && head-> val == head -> next-> val) head = head->next;
            head = head->next;//既可以指向下一个节点的同时,有可以接着处理上述的。
        }
        cur->next = NULL;
        return node.next;
    }
};