class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ tmp=head while tmp: while tmp.next and tmp.next.val==tmp.val: tmp.next=tmp.next.next tmp=tmp.next return head