I have a code like
string code = \"AABBDDCCRRFF\";
In this code, I want to retrieve only distinct characters
The Output should be l
How about in linq:
var str = "AABBCCDDDDDDEEEEEFFF"; var unique = str.ToCharArray().Distinct(); Console.WriteLine("Answer: {0}.", string.Join(string.Empty, unique));