Here is the code:
class Program
{
static void Main(string[] args)
{
Console.WriteLine(RemoveDuplicates("ajayreddy tutorials"));
}
public static string RemoveDuplicates(string s)
{
List<char> li = new List<char>();
bool foundDup=false;
for (int i = 0; i < s.Length; i++)
{
if (li.Count == 0)
{
li.Add(s[i]);
}
else
{
for (int j = 0; j < li.Count && j != i; j++)
{
if (s[i] == li[j])
{
foundDup = true;
}
}
if (!foundDup)
{
li.Add(s[i]);
}
else
{
foundDup = false;
}
}
}
return new string(li.ToArray());
}
}
This Solution is written by me and is not completely tested. Please comment if you found any alternative solutions or any enhancement to my solution.