/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* struct ListNode *next;
* };
*/
int pre;
struct ListNode* f(struct ListNode* head){
if(!head) return NULL;
if(head->val==pre){
struct ListNode* temp=head->next;
free(head);
return f(temp);
}else{
pre=head->val;
head->next=f(head->next);
}
return head;
}
struct ListNode* deleteDuplicates(struct ListNode* head) {
pre=INT_MAX;
return f(head);
}