s=>s.Select((x,i)=>$"{x}".PadLeft(s.Take(i).Sum(y=>y<92?-1:1)+x/48+(s[0]<92?1:0)48-s[0]/48+1))
Outputs a collection of strings, one for each line. Byte count also includes:
using System.Linq;
Try it online!Try it online!
Explanation:
s => // Take input, a string
s.Select((x, i) => // Replace every character with:
$"{x}" // The character as string
.PadLeft( // Pad with this many spaces:
s.Take(i) // Take characters, in the input string, preceding current one
.Sum(y => // Sum them by:
y < 92 ? -1 : 1 // If it's a \ add 1, if / subtract 1
)
+ x / 48 // If current slash is a \ add one more space
+- (s[0] </ 9248 ?+ 1 : 0) // If the first slash is a / add one more space
)
)