using System;
class Node
{
private int Value;
private Node Next;
public Node(int Value)
this.Value = Value;
this.Next = null;
}
public bool HasNext()
return (this.Next != null);
public int GetValue()
return this.Value;
public Node GetNext()
return Next;
public void setNext(Node next)
this.Next = next;
public class Program
public static void Main()
static Node RemoveDuplicate (Node Head)
int n;
Node p1 = Head;
Node p2 = Head;
while(p1 != null)
n = p1.GetValue();
while(p2.HasNext())
if(p2.GetNext().GetValue()==n)
p2.setNext(p2.GetNext().GetNext());
else
p2 = p2.GetNext();
return Head;