✅Accepted| | ✅Easy solution || ✅Short & Simple || ✅Best Method
\n# Code\n\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr)
\n# Code\n```\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n *     ListNode(int x) : val(x), next(nullptr) {}\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\n * };\n */\nclass Solution {\npublic:\n    ListNode* deleteDuplicates(ListNode* head) {\n        ListNode* t=head;\n        int c=1;\n        ListNode* dummy=new ListNode(1);\n        ListNode* ans=dummy;\n        int f=1;\n        while(f && t)\n        {\n            ListNode* p=t;\n            int c=0;\n            while(t->next && t->val==t->next->val)\n            {\n                c++;\n                t=t->next;\n            }\n            if(c==0)\n            {\n                ans->next=p;\n                ans=ans->next;\n            }\n            t=t->next;\n        }\n        ans->next=NULL;\n        return dummy->next;\n    }\n};\n```\nPlease **UPVOTE** if it helps \u2764\uFE0F\uD83D\uDE0A\nThank You and Happy To Help You!!
['C++']