Find non repeated char from string.

Write a program to Find all non-repeated char from given string.


For example:

Input:
India

Output:
nda

Solution:

using System;
using System.Linq;

namespace NonRepatedChar
{
    class Program
    {
        static void Main()
        {

            var str = "india";

            var ss = from ch  in str
                group ch by ch;

            foreach (var pa in ss)
            {
                if (pa.Count() < 2)
                {
                    Console.Write(pa.Key);
                }
            }

            Console.ReadLine();
        } 
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *