//统计重复字符串 如 eeefffkkkhjk 得到如下结果 3e3f3khjk; string zipStr = Console.ReadLine(); var charList = zipStr.ToCharArray(); var listArray = new List<char>(); foreach (var item in charList) { if (!listArray.Contains(item)) { listArray.Add(item); } } var dic = new Dictionary<string, string>(); int count = 0; foreach (var item in listArray) { foreach (var o in charList) { if (item == o) { count++; } } dic.Add(item.ToString(),count.ToString()); count = 0; } string resutl = string.Empty; foreach (var item in dic) { if (Convert.ToInt32(item.Value)<=1) { resutl += item.Key; } else { resutl += item.Key + item.Value; } } Console.WriteLine(resutl); Console.Read();