Skip to content

Instantly share code, notes, and snippets.

@w3Abhishek
Created March 14, 2022 03:33
Embed
What would you like to do?
Remove Duplicate Characters from a String
using System;
public class Program
{
public static void Main()
{
String inputStr, resultStr = String.Empty;
Console.WriteLine("Enter a string:");
inputStr = Console.ReadLine();
for(int i = 0; i < inputStr.Length; i++){
if(!resultStr.Contains(inputStr[i]+"")){
resultStr += inputStr[i];
}
}
Console.WriteLine("Final String: "+resultStr);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment