public static string Decompress(string input) { var outputBuilder = new StringBuilder(); var inputBuilder = new StringBuilder(input); while(inputBuilder.Length > 0) { switch (inputBuilder.FirstChar()) { case MultiVerbatimCharMarker: inputBuilder.PopChar(); var length = inputBuilder.PopChar(); outputBuilder.AppendAndPopCharFrom(inputBuilder, length); break; case SingleVerbatimCharMarker: inputBuilder.PopChar(); outputBuilder.AppendAndPopCharFrom(inputBuilder); break; default: outputBuilder.Append(PartDictionary[inputBuilder.PopChar()]); break; } } return outputBuilder.ToString(); }