Skip to content

Instantly share code, notes, and snippets.

@w3Abhishek
Created March 14, 2022 03:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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