public static void Main()
for(var i = 0; i < testCases.Length; i++)
var testCase = testCases[i];
Console.WriteLine($"--------- {i+1} ---------");
Console.WriteLine($"Input: {testCase}");
Console.WriteLine($"Output: {Compress(testCase)}");
private static string Compress(string inputString)
var result = new StringBuilder();
result.Append(lastCharCount);
foreach(char currentChar in inputString ?? "")
if(currentChar != lastChar)
return result.ToString();