Run-length encoding: Difference between revisions

→‎Linq: Shortened code by 1 line and better linq too.
(→‎Linq: Shortened code by 1 line and better linq too.)
Line 699:
 
public static string Decode(string input) => input
.SelectAggregate((t: "", o: Empty<string>()), (a, c) => !char.IsDigit(c) ? $("{c},", a.o.Append(a.t+c)) :$"{ (a.t + c}",a.o)).o
.ToDelimitedString("").Split(',').Where(c=>c!="")
.Select(p => new string(p.Last(), int.Parse(string.Concat(p.SkipLast(1)))))
.ToDelimitedString("");