using System.Collections.Generic;
public static void Main()
const string original = "aabbccddeefff";
var compressed = CompressBetter(original);
Console.WriteLine("Original : {0}", original);
Console.WriteLine("Compressed: {0}", compressed);
private static string CompressBetter(string str)
var sb = new StringBuilder();
for (var i = 1; i < str.Length; i++)
if (sb.Length >= str.Length){