def deleteDuplicates(self, head: ListNode) -> ListNode:
    current = head
    while current and current.next:
        if current.next.val == current.val:
            current.next = current.next.next
        else:
            current = current.next
    return head
def deleteDuplicates(self, head: ListNode) -> ListNode:
    current = head
    while current and current.next:
        if current.next.val == current.val:
            current.next = current.next.next
        else:
            current = current.next
    return head