# [Lua], 88 bytes Another attempt in Lua, this time with a completely different approach using string manipulation instead of a counter variable. <!-- language-all: lang-lua --> s=""for c in(...):gmatch"."do s=s:gsub("\\"," "):gsub("/?$",c):gsub(" /","/")print(s)end [Try it online!][TIO-j7ktd17o] Ungolfed: <pre><code>s = "" for c in string.gmatch((...), ".") do --for each character in the input --s contains the output from the previous iteration s = s:gsub("\\\\", " ") --Replace backslash with space -> indent by 1 s = s:gsub("/?$", c) --Remove any / at the end of the string and append c to the string s = s:gsub(" /", "/") --Remove a single space in front of any / -> un-indent by 1 print(s) end </pre></code> There's one interesting thing in the code: ```(...):gmatch"."``` This uses some quirks in the Lua parser. When Lua encounters a piece of code in the form ```func "string"```, it'll convert this to ```func("string")```. This is so that one can write ```print "string"``` to print a constant string and it only works with a single string literal after the function. Anything else will give a syntax error. However, this syntactic sugar also works with function calls in the middle of an expression, and more surprising, it works just fine together with the ```:``` method call syntactic sugar. So in the end, Lua will interpret the code like this: <pre><code>(...):gmatch"." -> (...):gmatch(".") -> string.gmatch((...), ".")</pre></code> If anyone can think of a way to remove one of the three gsub calls, please tell me. [Lua]: https://www.lua.org [TIO-j7ktd17o]: https://tio.run/##NYlLCsMwDESvIoYubAjW3hB6EW1Sp/lA65TIOb9i3OTNMPCYzzGYaQ9M206J1uxCCD7O36GkBQHjRtprnPV4OYigA8Ffys8HunQbcT0Z/revuTj17zyamVSY29a0cnP@I3IC "Lua – Try It Online"