public ListNode deleteDuplicates2(ListNode head) {
        if(head == null) return null;
        if(head.next == null) return head;

        ListNode prev = head;
        ListNode p = head.next;
        ListNode dummy = new ListNode(0);
        dummy.next = head;
        ListNode pprev = dummy;

        while(p != null){
            int val = prev.val;
            if(p.val == val){
                // prev.next == p.next;
                while(p != null && p.val == val){
                    // prev.next = p.next;
                    p = p.next;
                }
                pprev.next = p;
                // prev = p;
            }else{
                pprev = prev;
            }
            prev = p;
            if(p != null )p = p.next;
        }
        return dummy.next;
    }