# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]:
if head == None:
return head
t = head
while t.next != None:
if t.val == t.next.val:
t.next = t.next.next
else:
t = t.next
return head