#include <iostream>
#include <algorithm>
#include "string"
#include "vector"
#include "stack"
#include "set"
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode* deleteDuplicates(ListNode* head)
{
ListNode* p=head;
while (p != NULL&&p->next != NULL)
{
if (p->val == p->next->val)
p->next = p->next->next;
else
p = p->next;
}
return head;
}
int main()
{
ListNode *l1 = new ListNode(1);
ListNode *l2 = new ListNode(1);
ListNode *l3 = new ListNode(1);
l1->next = l2;
l2->next = l3;
deleteDuplicates(l1);
//cout << climbStairs(3);
system("pause");
return 0;
}