string x = "AABCDEF";
List<char> repeatedCharacters = new List<char>();
var groupsOfChars = x.GroupBy(letter => letter);
groupsOfChars.ToList().ForEach(item => {
if (item.Count() > 1) repeatedCharacters.Add(item.Key);
});
2 Responses
string x = "AABCDEEF";
List<char> repeatedCharacters = new List<char>();
var groupsOfChars = x.GroupBy(oChar => oChar);
groupsOfChars.ToList().ForEach(item =>
{
if (item.Count() > 1) repeatedCharacters.Add(item.Key);
}
);
repeatedCharacters.ForEach(Console.WriteLine);
string x = "AABCDEEF";
List<char> repeatedCharacters = new List<char>();
var groupsOfChars = x.GroupBy(oChar => oChar);
groupsOfChars.ToList().ForEach(item =>
{
if (item.Count() > 1) repeatedCharacters.Add(item.Key);
}
);
repeatedCharacters.ForEach(Console.WriteLine);
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.