Skip to main content
added 157 characters in body
Source Link

C# (.NET Core), 74 88 82 78 7777 76 + 18 bytes

-1 byte thanks to Kevin Cruijssen

s=>s.Select((x,i)=>$"{x}".PadLeft(s(x-s[0])/45-~s.Take(i).Sum(y=>y<92?-1:1)+(x-s[0])/45+1))

Explanation for 77 byte answer:

C# (.NET Core), 74 88 82 78 77 + 18 bytes

s=>s.Select((x,i)=>$"{x}".PadLeft(s.Take(i).Sum(y=>y<92?-1:1)+(x-s[0])/45+1))

Explanation:

C# (.NET Core), 74 88 82 78 77 76 + 18 bytes

-1 byte thanks to Kevin Cruijssen

s=>s.Select((x,i)=>$"{x}".PadLeft((x-s[0])/45-~s.Take(i).Sum(y=>y<92?-1:1)))

Explanation for 77 byte answer:

added 295 characters in body
Source Link

C# (.NET Core), 74 88 82 7878 77 + 18 bytes

s=>s.Select((x,i)=>$"{x}".PadLeft(s.Take(i).Sum(y=>y<92?-1:1)+x/48+(x-s[0])/48+145+1))

Try it online!Try it online!

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 - s[0]) / 4845 + 1 //         If first slash is a / add one more space, if current slash is a \ add one more space (I got this through power of MATHS!)
                                  //         How I arrived at this function:
                                  //         + x / 48        If current slash is a \ add one more space
            - s[0] / 48 + 1                 //         - s[0] / 48 + 1 If the first slash is a / add one more space
        )
    )

C# (.NET Core), 74 88 82 78 + 18 bytes

s=>s.Select((x,i)=>$"{x}".PadLeft(s.Take(i).Sum(y=>y<92?-1:1)+x/48-s[0]/48+1))

Try it online!

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] / 48 + 1       //         If the first slash is a / add one more space
        )
    )

C# (.NET Core), 74 88 82 78 77 + 18 bytes

s=>s.Select((x,i)=>$"{x}".PadLeft(s.Take(i).Sum(y=>y<92?-1:1)+(x-s[0])/45+1))

Try it online!

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 - s[0]) / 45 + 1 //         If first slash is a / add one more space, if current slash is a \ add one more space (I got this through power of MATHS!)
                                  //         How I arrived at this function:
                                  //         + x / 48        If current slash is a \ add one more space
                                  //         - s[0] / 48 + 1 If the first slash is a / add one more space
        )
    )
added 2 characters in body
Source Link

C# (.NET Core), 74 88 8282 78 + 18 bytes

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
        )
    )

C# (.NET Core), 74 88 82 + 18 bytes

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!

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), 74 88 82 78 + 18 bytes

s=>s.Select((x,i)=>$"{x}".PadLeft(s.Take(i).Sum(y=>y<92?-1:1)+x/48-s[0]/48+1))

Outputs a collection of strings, one for each line. Byte count also includes:

using System.Linq;

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] / 48 + 1       //         If the first slash is a / add one more space
        )
    )
added 5 characters in body
Source Link
Loading
added 116 characters in body
Source Link
Loading
Added explanation
Source Link
Loading
Source Link
Loading