public static void Main()
string test1="aaabccccdd";
Console.WriteLine(Compress(test1));
Console.WriteLine(Compress(test2));
Console.WriteLine(Compress(test3));
public static string Compress(string str)
StringBuilder res=new StringBuilder();
for(int i=0; i<str.Length; i++)
if(i+1>=str.Length || str[i]!=str[i+1])