using System.Collections.Generic;
public static void Main()
var result = RLE("AAAABBBCCXYZDDDDEEEFFFAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB");
Console.WriteLine("result: " + result);
public static string RLE(string s)
if(String.IsNullOrWhiteSpace(s))
for(int i=0; i<s.Length; i++)
if( symbol == prevSymbol)
else if(prevSymbol != '-')
result += prevSymbol.ToString() + counter;
result += prevSymbol.ToString() + counter;