import . "nc_tools"
func deleteDuplicates( head *ListNode ) *ListNode {
    if head == nil {
        return nil
    }
    ret := &ListNode{Next: head}
    
    p1, p2 := ret, head.Next // 双指针
    for p1.Next != nil && p1.Next.Next != nil && p2 != nil {
        p2 = p1.Next.Next
        if p1.Next.Val == p2.Val {
            for p2 != nil && p1.Next.Val == p2.Val {
                p2 = p2.Next
            }
            p1.Next = p2
            continue
        }
        p1 = p1.Next
        p2 = p2.Next
    }

    return ret.Next
}