public class StringDataStructure { //Find the duplicate character public StringBuilder GetDuplicateCharacter(string _title) { StringBuilder result = new StringBuilder(); StringBuilder duplicateChar = new StringBuilder(); foreach (var item in _title) { if (result.ToString().IndexOf(item.ToString().ToLower()) == -1) { result.Append(item); } else { duplicateChar.Append(item); } } return duplicateChar; } }