struct ListNode* deleteDuplicates(struct ListNode* head ) {
// write code here
if(head==NULL)
return NULL;
if(head->next==NULL)
return head;
struct ListNode *p1,*p2,*t;
p1=head;
p2=head->next;
while(p1!=NULL && p2!=NULL){
if(p1->val==p2->val){
p1->next=p2->next;
t=p2;
p2=p2->next;
free(t);
}
else{
p1=p1->next;
p2=p2->next;
}
}
return head;
}