/*
 * function ListNode(x){
 *   this.val = x;
 *   this.next = null;
 * }
 */

/**
  * 
  * @param head ListNode类 
  * @return ListNode类
  */
function deleteDuplicates( head ) {
    // write code here
    if(head == null || head.next == null){ return head}
    const top = {}
    top.next = head
    var current = top
    while(current.next && current.next.next){
        if(current.next.val == current.next.next.val){
            var val = current.next.val
            while(current.next && current.next.val == val){
                current.next = current.next.next
            }
        }else{
        current = current.next
        }
    }
    return top.next
}
module.exports = {
    deleteDuplicates : deleteDuplicates
};