class ListNode:
    def __init__(self, val=0, next=None):
        self.val = val
        self.next = next

def delete_duplicates(head: ListNode) -> ListNode:
    current = head
    
    while current and current.next:
        if current.val == current.next.val:
            current.next = current.next.next  # حذف العنصر المكرر
        else:
            current = current.next  # الانتقال للعقدة التالية
    
    return head

# مثال للاختبار
def print_list(node):
    while node:
        print(node.val, end=" ")
        node = node.next

# إنشاء القائمة المرتبطة [1,1,2,3,3]
head = ListNode(1, ListNode(1, ListNode(2, ListNode(3, ListNode(3)))))

# تطبيق دالة حذف التكرارات
new_head = delete_duplicates(head)

# طباعة النتيجة
print_list(new_head)
