Run-length encoding: Difference between revisions

Content added Content deleted
m (→‎Linq: code typo)
(→‎Linq: More idiomatic Linq and faster)
Line 702:
public static string Decode(string input) => input
.Aggregate((t: "", o: Empty<string>()), (a, c) => !char.IsDigit(c) ? ("", a.o.Append(a.t+c)) : (a.t + c,a.o)).o
.Select(p => new string(p.Last(), int.Parse(string.Concat(p.SkipLastWhere(1char.IsDigit)))))
.StringConcat();