Skip to content

Instantly share code, notes, and snippets.

@w3Abhishek
Created March 14, 2022 03:33
Show Gist options
  • Save w3Abhishek/e3223fbba9e96b8e06e96ef3a824e5c6 to your computer and use it in GitHub Desktop.
Save w3Abhishek/e3223fbba9e96b8e06e96ef3a824e5c6 to your computer and use it in GitHub Desktop.
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