思路:
1.对于当前节点,利用while循环删掉后面值和他相等的节点即可


/*
 * public class ListNode {
 *   int val;
 *   ListNode next = null;
 * }
 */

public class Solution {
    /**
     * 
     * @param head ListNode类 
     * @return ListNode类
     */
    public ListNode deleteDuplicates (ListNode head) {
        // write code here
        if(head == null || head.next == null){
            return head;
        }
        ListNode  currentNode = head;
        while(currentNode != null){
            ListNode next = currentNode.next;
            while(next != null && currentNode.val == next.val){
                currentNode.next = next.next;
                next = next.next;
            }
            currentNode = currentNode.next;
        }
        return head;
    }
}