How to find Non repeatable character from String..

Omniitstudent
Posted by Omniitstudent under C# category on | Points: 40 | Views : 1149
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication8
{
class Program
{
static void Main(string[] args)
{
string str = Console.ReadLine();
string distinctstring = string.Empty;

foreach (char c1 in str)
{
int c =0;
foreach (char c2 in str)
{
if (c1==c2)
{
c += 1;

}
}
if (c==1)
{
distinctstring += c1.ToString();


}
}
Console.WriteLine(distinctstring);
Console.ReadLine();
}
}
}

Input--- soon
output--- sn

crazy code

Comments or Responses

Login to post response