using System.Text.RegularExpressions;
using System.Collections.Generic;
public static class Program
public static void Main()
string[] aLst = new string[]{"B:1", "C:4", "A:2", "B:-1", "A:2", "D:2"};
List<string> charCnt = new List<string>();
foreach (var item2 in aLst)
string[] val2 = item2.Split(':');
string second2 = val2[1];
if (charCnt.Any(str => str.Contains(first2)))
val = aLst.Where(c => charCnt.Any(f => c.StartsWith(first2))).First().ToString();
string[] val1 = val.Split(':');
string second1 = val1[1];
int newVal1 = Convert.ToInt32(second1);
int newVal2 = Convert.ToInt32(second2);
int newVal = newVal1 + newVal2;
string strVal = first1.ToString() + ":" + newVal;
int index = charCnt.FindIndex(s => s.StartsWith(first2));
foreach (var item in charCnt.OrderBy(q => q).ToList())
Console.WriteLine(concat.Trim().TrimEnd(','));