```
class Solution(object):
def deleteDuplicates(self, head):
p = head
if p is None: return p
while p.next:
if p.val==p.next.val:
p.next = p.next.next if p.next.next else None
else:
p = p.next
return head
```