/*
struct ListNode {
    int val;
    struct ListNode *next;
    ListNode(int x) :
        val(x), next(NULL) {
    }
};
*/
class Solution {
public:
    ListNode* deleteDuplication(ListNode* pHead) {
        //head replicate
        ListNode* new_head=new ListNode(-1);
        new_head->next=pHead;
        ListNode* front=new_head;
        ListNode* cur=pHead;
        ListNode* next=pHead;
        while(next)
        {
            while(next&&next->val==cur->val)
            {
                next=next->next;
            }
            if(cur->next!=next)
            {
                front->next=next;
                cur=next;
            }
            else{
                front=cur;
                cur=next;
            }
            

        }
        return new_head->next;

    }
};