class Solution {
public:
ListNode* removeDuplicateNodes(ListNode* head) {
ListNode *p=head;
ListNode *q;
ListNode *l;
while(p!=NULL){
q=p->next;
l=p;
while(q!=NULL){
if(p->val==q->val){
l->next=q->next; //删除重复元素
q=l->next;
}else{
l=l->next;
q=q->next;
}
}
p=p->next;
}
return head;
}
};