# [C# (.NET Core)], <s>74</s> <s>88</s> 82 + 18 bytes <!-- language-all: lang-cs --> s=>s.Select((x,i)=>$"{x}".PadLeft(s.Take(i).Sum(y=>y<92?-1:1)+x/48+(s[0]<92?1:0))) Outputs a collection of strings, one for each line. Byte count also includes: using System.Linq; [Try it online!][TIO-j7k5crkw] 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] < 92 ? 1 : 0) // If the first slash is a / add one more space ) ) [C# (.NET Core)]: https://www.microsoft.com/net/core/platform [TIO-j7k5crkw]: https://tio.run/##ZVBRT8IwEH7vr6jEhzZAB8YHBTpjCBgTTIyQ@CA@1HJIY9fh2ukI2W@f3aaQyZdce/m@u/uulbYr4wSK1Crzjuc76yBiM2U@hwgZEYHdCgl//DjWGqRTsbHsDgwkSqI9wh5SC2vxbZXXTAnrhFMSf8VqhR@EMoQepGNRiWlq5Mi6xO/QwfcTk0aQiDcNv1wY4jXmheWhZXMoVyAk6yjKw/PWPstb7FGsZrB2xLKF@ACiKJunEdnxcDe6vrjp9gd92s6Cy6s2sS@915LrD3qU0mLYWKN2w8psU9dUvjdKAyakkjDHY/8FsQb2BN5ZGSCU4jOOTao1bTQ231liXQ9hi0RFvo0t4pmyjlA2jZOJkBuSYR4eDJ4T5aByyCgdngw7LftXlKNmlqO8WB6BfASBj/oMAhSUueerG1XSMvgB "C# (.NET Core) – Try It Online"