How to remove duplicate characters from a string? || Coding Challenge

    // How to remove duplicate characters from a string?
    static void Main(string[] args)
    {
        string test ="aabaccdddeffa";

        Console.WriteLine("remove duplicate");
        string temp = "";
        foreach(char cha in test)
        {
         
            if (!temp.Contains(cha))
                temp += cha;


        }
        Console.WriteLine(temp);

    }




Leave a Reply

Your email address will not be published. Required fields are marked *