text:
Exponentiation Sequence
The oldest Polish salt mine, located in Bochnia*, was started in year 1248, which we can consider a magical number. We can see that it's equal to 4 digits from the sequence of exponentiations: .
As the date is actually 4 digits from the sequence, we could make it longer. We could repeat the process until we reach infinity. The sequence would look like this, if we limit it to number 2048
124816326412825651210242048

To make it look a bit better, we can separate the numbers:
1|2|4|8|16|32|64|128|256|512|1024|2048

Let's try a custom, longer sequence than the date. Let's say, we want it to have 5 digits - there are more than one possibility:

24816
81632
64128

Or 3 digit ones:

124
248
816

We could also add the 3 digit numbers to this, but let's say, that a sequence must have at least two numbers.
* There is no information about this on the English Wikipedia. If you enter the Polish version - then there is. If you visit the mine, the workers will also tell you, that it started in 1248.
The challenge
Create a exponentiation sequence like in examples above with 2 as the base.
Given a number from range 2-27, output all possible parts of the sequence (The 2048 one or larger if you want) with amount of digits equal to the input. You cannot cut a number, so output like 481 is invalid, because 16 is cut in half.
Rules:

Standard loopholes are forbidden.
You can assume the input is a number inside the range.
Your program can accept inputs larger than the range (28+), but that won't increase/decrease score.
Spaces in output are ignored. You can output like 124 or like 4 8 16.
Different possibilities should be separated by any character from the list: ,./| or a line feed.
You can output as an array.
Every possibility should include at least 2 different numbers.
You must output a part of the sequence, you cannot mix numbers that aren't next to each other, like: 14.
Hardcoded output isn't allowed, however, you can hardcode a string/number/array containing the full sequence.
Input 27 should return the full 2048 sequence.
As already mentioned before, do not cut numbers. Ex. 16 must stay 16 - you can't use 481 - you must use 4816.
EDIT: I might have said something wrong there; 2048 is the last number which your program should support, you can add support for larger int's.

Test cases
Input: 2
12, 24, 48

Input: 3
124, 248, 816

Input: 4
1248, 4816, 1632, 3264

Input: 5
24816, 81632, 64128

Input: 27
124816326412825651210242048

And later numbers...
If I made a mistake in any of the test cases, tell me or edit the question.

This is code-golf, so the shortest code in bytes wins!

So this is only with 2 as the base, correct? Could you clarify that in the question? I'm not sure if it's implied by "Sequence of Exponentiations," but even if it is, I'm sure there are people out there like me who don't know that.

@cole Actually, yes, it's only with 2. Thanks for mentioning!

Can output be separated by newline?

@H.PWiz Actually, why not? Let me just edit the question.

I can't say that I don't keep upvoting every single answer here. The genius of people on ppcg is just amazing.

Does the output order matter?

@Shaggy No. You can output in any order you want.

Pushing my luck here but would this be an acceptable form of output?

@Shaggy No. I don't think I should allow it. I never seen anything output this way.

No worries; like I said, I was pushing it. Some challenge authors can be incredibly flexible on the output format so, for the sake of a byte or 2, it's worth asking ;) (Note: That should not be interpreted as a suggestion!)

You are missing 163264128256512102420484096 and 641282565121024204840968192 from the sequence generated from 27.

@kamoroso94 No, I'm not. I stated that if you want to support larger sequences than 2048, you can. But it's optional

In the intro, you should capitalize Polish.  "polish" is a different English word.

05AB1E, 12 11 10 bytes
Supports the sequence up to 2^95 = 39614081257132168796771975168
₃ÝoŒʒg≠}Jù

Try it online!
Explanation
₃Ý            # push range [0 ... 95]
  o           # raise 2 to the power of each
   Œ          # get a list of all sublists
    ʒ         # filter, keep elements that satisfy:
     g        # length
      ≠       # false (not equal to 1)
       }      # end filter
        J     # join each
         ù    # keep numbers of length matching the input

Saved 1 byte thanks to Erik the Outgolfer
Saved 1 byte thanks to Riley

X› can be ≠

@EriktheOutgolfer: Oh yeah. I always forget that one exist now. Thanks :)

Can Y₃Ým be ₃Ýo?

@Riley: Yep. I had that before, but for some reason I must have changed it. Thanks :)

Trying the code now (much late after challenge end)... and your solution seems to return tons of empty arrays for me... Am I doing something wrong?

@Soaku: Yeah, there have been a lot of changes to the language recently so old programs might not be compatible in all cases. If you want to run this code you can checkout an interpreter from the time of this challenge. You could also add s as the second last character to get this answer working in the new interpreter.

Pyth, 22 21 20 17 bytes
fqQlTjLkt#.:^L2yT

Try it Online
Explanation
fqQlTjLkt#.:^L2yT
            ^L2yT  Get the powers of 2 up to 2^20
        t#.:       Get all consecutive sequences of at least 2
     jLk           Concatenate each
fqQlT              Get the ones whose length is the input

21 bytes: fqQlTmjkdftlT.:m^2d12

20 bytes - fqQlTjLkftlT.:m^2d12

19 bytes - fqQlTjLkftT.:m^2d12

18 bytes - fqQlTjLkftT.:^L2yT

17 bytes - fqQlTjLkt#.:^L2yT

Jelly,  19 18  16 bytes
There may be a shorter solution now that we may use any cut-off (not just 2048), although this change to the specification has allowed a one byte save from this implementation by moving to a cut-off of 32768.
--yep...
-2 bytes thanks to Erik the Outgolfer (use of V to allow implicit right argument of the filter and tightening)
--yes it is very similar to his inefficient one now; go upvote his!
⁴Ḷ2*Ẇṫ17VDL$⁼¥Ðf

A monadic link taking a number and returning a list of numbers.
Try it online!
How?
⁴Ḷ2*Ẇṫ17VDL$⁼¥Ðf - Link: number, n        e.g. 3
⁴                - literal sixteen             16
 Ḷ               - lowered range               [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
  2              - literal two                 2
   *             - exponentiate                [1,2,4,8,16,32,...,32768]
    Ẇ            - all sublists                [[1],[2],...,[1,2],[2,4],...,[1,2,4],...]
      17         - literal seventeen           17
     ṫ           - tail from index             [[1,2],[2,4],...,[1,2,4],...]]
        V        - evaluate as Jelly code      [12,24,...,124,...]
              Ðf - filter keep:
             ¥   -   last two links as a dyad
           $     -     last two links as a monad:
         D       -       decimal list (of entry) (i.e. 816 -> [8,1,6] or 24 -> [2,4])
          L      -       length                  (i.e. 816 -> 3, or 24 -> 2)
            ⁼    -   equals (n)                  (i.e. 816 -> 1, or 24 -> 0)
                 - ...resulting in             [816, 124, 248]

Is this too similar to yours? (please be honest :p)

Funnily enough I was just trying to use V and it'll work for 16 rather than 1000: ⁴Ḷ2*Ẇṫ17VDL$⁼¥Ðf.

I'm going for the most :p

@EriktheOutgolfer they may now be similar but I am of the mind we should both keep them I'm sure you came up with yours independently and I'm sure I'd have found the eval trick too (since I was looking at exactly that, just needed to get the chaining right).

@EriktheOutgolfer I have made the assumption you are male, and prefer to be referred to as such, but actually do not know either as fact; do let me know if you prefer a different pronoun!

I will keep mine. Oh, and your assumption is correct, because I don't think "Erik" is a female name is it? ;p

Not normally, but one can never be 100% sure of these things :)

Perl 6, 62 59 bytes
{grep *.comb==$_,map {[~] 2 X**[...] $_},combinations 12,2}

Try it online!

Japt, 22 20 19 16 bytes
Supports input up to 639 but gaps start appearing in the sequence after 234 (See the full list of supported input ranges here). Outputs an array of strings.
IÆIo!²ãX m¬lUÃ¤c

Test it
I (64) could be replaced with L (100) but we'd be getting into scientific notation and precision inaccuracies. Filtering those out would, obviously, increase the byte count and only raise the maximum input to 736.
                     :Implicit input of integer U
I                    :64
 Æ                   :Map each X in [0,64)
  Io                 :  Range [0,64)
    !²               :  Raise 2 to the power of each
      ãX             :  Subsections of length X
         m           :  Map
          ¬          :    Join
           lU        :  Filter elements of length U
             Ã       :End map
              ¤      :Slice off the first 2 elements
               c     :Flatten

Husk, 18 17 bytes
Output is separated by newlines
fo=⁰LmṁsftQ↑12¡D1

Try it online!
How?
           ↑12¡D1    The sequence [1,2,4...2048]
              ¡      Repeatedly apply function, collecting results in a list
               D     double
                1    initially applying to 1
           ↑12       Take the first 12 elements
          Q          Get all sublists
        ft           With a length greater than 1
     mṁs             Convert each list into a string, e.g [4,8,16] -> "4816"
fo=⁰L                Keep only those whose length is equal to the input

Python 2, 105 bytes
lambda l,r=range:[x for x in[''.join(`2**n`for n in r(i,j+2))for i in r(13)for j in r(i,11)]if len(x)==l]

Try it online!

Haskell, 72 67 bytes
f n=[s|i<-[0..99],j<-[i+1..99],s<-[show.(2^)=<<[i..j]],length s==n]

Try it online!
Saved 5 bytes thanks to Laikoni
I used a limit of 99 because 2^99 has a length > 27.

It's returning extra cases for an input of 27 though.

You can replace 99 with 11, so it becomes more valid. Although, I did not state that numbers > 2048 are invalid. I stated only, that 2048 is the minimum range.

@JonathanAllan I think it's still correct: "The 2048 one or larger if you want" I took the 633825300114114700748351602688 sequence, because it guarantees that there won't be any other solution (in the range 2-27). Actually, I think a 45 limit would be sufficient, because length$(show$2^44)++(show$2^45)==28.

@jferard that was actually edited in after your answer (it actually stated "limited to 2048" before). I can shorten mine in this case too.

@JonathanAllan Yes, I actually realised that some of rules in the question are wrong and misleading just after posting this anwer.

@JonathanAllan I wasn't cheating: I simply didn't see this limitation when I posted my answer! As Soaku stated, that does not change anything for my answer : 11 vs 99.

@jferard yeah, I didn't think you were cheating :)

s<-[show.(2^)=<<[i..j]] saves some bytes.

Jelly, 16 bytes
ȷḶ2*ẆṫȷḊVDL$⁼¥Ðf

Try it online!
Note: very inefficient. Returns a list of numbers.

Tio doesn't seem to be able to parse this code... It always exceeds 60 seconds...

@Soaku Try replacing the ȷs (i.e. 1000) with 20s (lower upper limit).

@Soaku it works in theory - it just times out because it is very inefficient.

@ErikTheOutgolfer Then there is no output

@Soaku Did you follow my link? There is output there.

@EriktheOutgolfer Weird. Not for me. I followed your link, replaced the J-thing with 20. And no output.

@Soaku I meant on my comment. I have already replaced them there, and there's output [12, 24, 48].

@EriktheOutgolfer Oh, sorry, did not notice the second ȷ

@EriktheOutgolfer By the way, you can just simply replace those J with different Jelly built-in, since my challenge requires you to support at least the 2048 sequence.

@Soaku Why not go for the most if you can without extra cost? ;)

JavaScript (ES7), 102 100 bytes
Prints all matching sub-sequences with alert().
l=>[...1e11+''].map((_,k,a)=>a.map((_,x)=>(s=(g=n=>x<=k|n<k?'':g(n-1)+2**n)(x)).length-l||alert(s)))

Demo
NB: This snippet is buffering the results and printing them to the console for user-friendliness.

let f =

l=>[...1e11+''].map((_,k,a)=>a.map((_,x)=>(s=(g=n=>x<=k|n<k?'':g(n-1)+2**n)(x)).length-l||alert(s)))

alert = s => res += ' ' + s;

for(l = 2; l <= 27; l++) {
  res = '';
  f(l);
  console.log('L = ' + l + ' -->' + res);
}

Mathematica, 122 bytes
(s=#;FromDigits@F[f/@#]&/@Select[Subsequences[Array[2^#&,99,0]],l@#>1&&(l=Length)@(F=Flatten)[(f=IntegerDigits)/@#]==s&])&

Input

[27]

Output

{879609302220817592186044416, 134217728268435456536870912,
  524288104857620971524194304, 163843276865536131072262144,
  204840968192163843276865536, 256512102420484096819216384,
  641282565121024204840968192, 163264128256512102420484096,
  124816326412825651210242048}

Input [1000]
Output  1441151880758558722882303761517117445764607523034234881152921504606846976230584300921369395246116860184273879049223372036854775808184467440737095516163689348814741910323273786976294838206464147573952589676412928295147905179352825856590295810358705651712118059162071741130342423611832414348226068484722366482869645213696944473296573929042739218889465931478580854784377789318629571617095687555786372591432341913615111572745182864683827230223145490365729367654460446290980731458735308812089258196146291747061762417851639229258349412352483570327845851669882470496714065569170333976494081934281311383406679529881638685626227668133590597632773712524553362671811952641547425049106725343623905283094850098213450687247810566189700196426901374495621121237940039285380274899124224247588007857076054979824844849517601571415210995964968969903520314283042199192993792198070406285660843983859875843961408125713216879677197516879228162514264337593543950336158456325028528675187087900672316912650057057350374175801344

C, 170 bytes
i,j;f(n){char t[99],s[12][5]={"1"};for(i=j=1;i<12;)sprintf(s+i++,"%d",j*=2);for(i=0;i<12;++i,strlen(t)-n||j>1&&puts(t))for(j=*t=0;strlen(t)<n&&j+i<12;)strcat(t,s+i+j++);}

Try it online!
Unrolled:
i,j;
f(n)
{
    char t[99], s[12][5] = {"1"};
    for (i=j=1; i<12;)
        sprintf(s+i++, "%d", j*=2);
    for (i=0; i<12; ++i, strlen(t)-n || j>1 && puts(t))
        for (j=*t=0; strlen(t)<n && j+i<12;)
            strcat(t, s+i+j++);
}

K (ngn/k), 33 bytes
{(x=#:')#,/{,/'$x':|2/=12}'2+!11}

Try it online!
Generates all possible sublists, then selects those of the proper length. Returns a list of strings.

{...}'2+!11 generate 2..12 (the valid sublist lengths for input from 2..27), and run the code in {...} on each of those numbers

|2/=12 generate the sequence 1 2 4 8 16 32 64 128 256 512 1024 2048
,/'$x': take x-length rolling windows, converting each to strings, then concatenate them (e.g., 1 2 4 8 => (1 2;2 4;4 8) => ((,"1";,"2");(,"2";,"4");(,"4";,"8")) => ("12";"24";"48"))

(x=#:')#,/ flatten the potential strings, keeping those of the desired length

Perl 5, 76 bytes
75 bytes of code + 1 for -a
for$i(0..10){$/='',(map$/.=2**$_,$i..$_)&&$F[0]-length$/||say$/for$i+1..11}

Try it online!

R, 99 bytes
function(n)for(i in 1:11)for(j in i:11+1)if(sum(nchar(x<-2^(0:11))[i:j])==n)cat(x[i:j],"\n",sep="")

Try it online!

Ruby, 94 bytes
->n{a=*b=1;a<<b*=2until b>3**n;(2..n).flat_map{|x|a.each_cons(x).map &:join}.grep /^.{#{n}}$/}

Try it online!


text:
Tips for golfing in Proton
Proton is a quite new language created by PPCG user Hyper Neutrino.
It is very similar to Python, and has similar syntax to the language Cheddar, hence there are some clever tricks you can use in order to reduce your byte count. Let's get those cool tricks listed here. As usual, please post one tip per answer and avoid obvious things (e.g. remove spaces). If you have any further questions about any of the tips listed, there is a dedicated chat room for Proton.

To any potential close voters, tips questions are perfectly on-topic here.

Use currying when you need a lambda with 2 arguments
If you want a function with 2 arguments, currying syntax always saves 1 byte. For example:
f=(a,b)=>a+b

Is one byte longer than:
f=a=>b=>a+b

The first function can be called with f(number_1, number_2), whilst the latter is called using f(number_1)(number_2).
Try it online!

Take advantage of the fun features: operator functions
(+) for all binary operators where the + is evaluates to a function that performs the exact same task as the operator itself. Where you'd use int.__add__ when golfing in Python, use (+) for many bytes saved.

Use ..-ranges
Instead of using range(lower_bound, upper_bound), use lower_bound..upper_bound. For unary ranges, use 0..number instead of range(number). Some examples:
range(1,10)

Can be replaced by (-6 bytes):
1..10

And:
range(10)

Can be replaced by (-4 bytes):
0..10

Use inline-assignment
Consider the following two:
a=>(a+5)*2/(a+5)
a=>(b=a+5)*2/b

You can use inline assignments (where you treat an assignment as an expression) in Proton. The value given will be the right side of the assignment. This can sometimes help you take off a few bytes; more the longer the repeated expression, and especially if it has brackets already (because you need the brackets around the expression).

Use point-free notation
Even though lambda notation has a much shorter overhead than Python (a=> vs lambda a:), point-free notation is still often shorter, where you define a function as a composition of other functions. For example, consider the following chain of golfing:
a=>b=>dict(a)[b]
a=>dict(a).get
dict+((.)&get)

The last one currently isn't any shorter than the second last, but it does become shorter in some cases, for example, this:
a=>b=>[dict(a).get(f)for f:b]
a=>b=>map(dict(a).get,b)
a=>map(dict(a).get)
dict+((.)&get)+map

You can get some pretty short code with that. a & b will return a function *q => a(*q, b) if a is a function and otherwise *q => b(a, *q) if b is a function, and a + b will return a function *q => b(a(*q)).

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Badugi, Who Wins?

Inspired by this challenge and related to this one.
Background
Badugi [bæduːɡiː] is a low-ball draw-poker variant.
The Pokerstars World Cup Of Online Poker $1K event starts within 3 hours and I'll need to know how good my hands are!
The game uses a standard deck of 52 cards of four suits and thirteen ranks. The suits are unordered and shall be labelled cdhs; the ranks - ordered from highest K to lowest A - are KQJT98765432A. As such the full deck may be represented as follows (space separated):
Kc Kd Kh Ks Qc Qd Qh Qs Jc Jd Jh Js Tc Td Th Ts 9c 9d 9h 9s 8c 8d 8h 8s 7c 7d 7h 7s 6c 6d 6h 6s 5c 5d 5h 5s 4c 4d 4h 4s 3c 3d 3h 3s 2c 2d 2h 2s Ac Ad Ah As

Each player is dealt four cards from the deck, there are four betting rounds with three drawing rounds in-between (a player always has four cards, they have the option of changing 0-4 of their cards with new ones from the dealer on each of the three drawing rounds).
If more than one player is still active after all these rounds there is a showdown, whereupon the strongest hand(s) win the wagered bets.
The game is played low-ball, so the lowest hand wins, and as mentioned above  A (ace) is low. Furthermore the hand ranking is different from other forms of poker, and can be somewhat confusing for beginners.
The played "hand" is the lowest ranked combination made from the highest number of both "off-suit" (all-different-suits) and "off-rank" (all-different-ranks) cards possible (from the four held cards). That is: if one holds four cards of both distinct suits and distinct ranks one has a 4-card hand (called a "badugi"); if one does not have a 4-card hand but does have some set or sets of three cards of both distinct suits and distinct ranks one has a 3-card hand (one chooses their best); if one has neither a 4-card hand or a 3-card hand one probably has a 2-card hand, but if not one has a 1-card hand.

As such the best possible hand is the 4-card hand 4-3-2-A - the lowest off-rank cards of four different suits, often termed a "number-1". The weakest possible hand would be the 1-card hand K and is only possible by holding exactly Kc Kd Kh Ks.
Note that 4c 3h 2c As is not a "number-1", since the 4c and 2c are of the same suit, but it is the strongest of the 3-card hands, 3-2-A, it draws with other 3-2-1s (like Kh 3d 2s Ah) and beats all other 3-card hands but loses to all 4-card hands (which could be as weak as K-Q-J-T).

The other possible 3-card hand that could be made from  4c 3h 2c As is 4-3-A, but that is weaker (higher) so not chosen.

Similarly 8d 6h 3s 2h is a 3-card hand played as 8-3-2 - there are two off-rank off-suit combinations of size 3 and 8-3-2 is better (lower) than 8-6-3 since the three (or "trey") is lower than the six.

Comparing hands against one another follows the same logic - any 4-card beats any 3-card, any 3-card beats any 2-card and any 2-card beats any 1-card, while hands of the same number of used cards are compared from their highest rank down to their lowest (for example: 8-4-2 beats 8-5-A but not any of 8-4-A, 8-3-2 or 7-6-5)
The challenge:
Given two unordered-collections each of four cards, identify the one(s) which win a Badugi showdown (identify both if it is a draw).
The input may be anything reasonable:

a single string of all eight cards as labelled above (with or without spaces) with the left four being one hand and the right the other (with an optional separator); or a list of characters in the same fashion
a list of two strings - one per hand, or a list of lists of characters in the same fashion
two separate strings or list inputs, one per hand
the cards within the hands may be separated already too (so a list of lists of lists is fine)

Note, however:

the cards may not be arranged into any order prior to input
...and the suits and ranks are fixed as the character labels specified here -
If your language does not support such constructs just suggest something reasonable and ask if it is an acceptable alternative given your languages constraints.

The output should either be

formatted the same as the input, or a printed representation thereof; or
be one of three distinct and consistent results (e.g.: "left", "right", "both"; or 1, 2, 3; etc.)

Really - so long as it is clear which of the two inputs are being identified it should be fine.
Test cases
input                      ->  output
                                   (notes)
----------------------------------------------------------------------------
3c 2s 4d Ah - As 3h 2d 4h  ->  3c 2s 4d Ah
                                   (4-card 4-3-2-A beats 3-card 3-2-A)

3c 2s 4d Ah - As 2c 3d 4h  ->  3c 2s 4d Ah - As 2c 3d 4h
                                   (4-card 4-3-2-A draws with 4-card 4-3-2-A)

2d Ac 4h 3c - Kh Ad 9s 2c  ->  Kh Ad 9s 2c
                                   (3-card 4-2-A loses to 4-card K-9-2-A)

Kc Tc Qc Jc - Ac Ad Ah As  ->  Ac Ad Ah As
                                   (1-card T loses to 1-card A)

9c 9h Qc Qh - Qs Kh Jh Kd  ->  Qs Kh Jh Kd
                                   (2-card Q-9 loses to 3-card K-Q-J)

2d 5h 7c 5s - 2h 3c 8d 6c  ->  2d 5h 7c 5s
                                   (3-card 7-5-2 beats 3-card 8-3-2)

3s 6c 2d Js - 6h Jd 3c 2s  ->  6h Jd 3c 2s
                                   (3-card 6-3-2 loses to 4-card J-6-3-2)

Ah 6d 4d Ac - 3h 2c 3s 2s  ->  3h 2c 3s 2s
                                   (2-card 4-A loses to 2-card 3-2)

2h 8h 6h 4h - 6d 2d 5d 8d  ->  2h 8h 6h 4h - 6d 2d 5d 8d
                                   (1-card 2 = 1-card 2)

This is code-golf, so the shortest code in bytes wins per-language, and the shortest code overall wins. Don't let golfing languages put you off submitting in other languages, and ...have fun!

Is something like [['3c', '2s', '4d', 'Ah'], ['As', '3h', '2d', '4h']] reasonable?

@EriktheOutgolfer Yes - I was going to say I think you can just add O to the front.

JavaScript (ES6), 209 202 192 182 181 bytes
Saved 7 bytes thanks to @Neil
Takes input as an array of arrays of strings. Returns true if the first hand wins, false if the second hand wins, or 2 in the event of a tie.
a=>([a,b]=a.map(a=>a.reduce((a,x)=>[...a,...a.map(y=>[x,...y])],[[]]).map(a=>!/(\w).*\1/.test(a)*a.length+a.map(a=>'KQJT98765432A'.search(a[0])+10).sort()).sort().pop()),a==b?2:a>b)

Test cases

let f =

a=>([a,b]=a.map(a=>a.reduce((a,x)=>[...a,...a.map(y=>[x,...y])],[[]]).map(a=>!/(\w).*\1/.test(a)*a.length+a.map(a=>'KQJT98765432A'.search(a[0])+10).sort()).sort().pop()),a==b?2:a>b)

console.log(f([["3c","2s","4d","Ah"], ["As","3h","2d","4h"]])) // true  (1st hand wins)
console.log(f([["3c","2s","4d","Ah"], ["As","2c","3d","4h"]])) // 2     (tie)
console.log(f([["2d","Ac","4h","3c"], ["Kh","Ad","9s","2c"]])) // false (2nd hand wins)
console.log(f([["Kc","Tc","Qc","Jc"], ["Ac","Ad","Ah","As"]])) // false (2nd hand wins)
console.log(f([["9c","9h","Qc","Qh"], ["Qs","Kh","Jh","Kd"]])) // false (2nd hand wins)
console.log(f([["2d","5h","7c","5s"], ["2h","3c","8d","6c"]])) // true  (1st hand wins)
console.log(f([["3s","6c","2d","Js"], ["6h","Jd","3c","2s"]])) // false (2nd hand wins)
console.log(f([["Ah","6d","4d","Ac"], ["3h","2c","3s","2s"]])) // false (2nd hand wins)
console.log(f([["2h","8h","6h","4h"], ["6d","2d","5d","8d"]])) // 2     (tie)

How?
a => (
  // store the best combination for both hands in a and b respectively
  [a, b] = a.map(a =>
    // compute the powerset of the hand
    a.reduce((a, x) => [...a, ...a.map(y => [x, ...y])], [[]])
    // for each entry:
    .map(a =>
      // invalidate entries that have at least 2 cards of same rank or same value
      !/(\w).*\1/.test(a) *
      // the score of valid entries is based on their length ...
      a.length +
      // ... and their card values, from highest to lowest
      // (we map 'KQJT98765432A' to [10 - 22], so that the resulting
      // strings can be safely sorted in lexicographical order)
      a.map(a => 'KQJT98765432A'.search(a[0]) + 10).sort()
    )
    // keep the best one
    .sort().pop()
  ),
  // compare a with b
  a == b ? 2 : a > b
)

Do you need that join?

Perl 6, 128 bytes
{.map({.combinations(1..4).grep({!.join.comb.repeated}).map({-$_,$_».trans('ATK'=>'1BZ')».ord.sort(-*)}).min}).minpairs».key}

Try it online!
Takes a list of hands (also more than two) which are lists of cards which are strings like Kc. Returns the indices of the hands with the lowest score. For two hands this is (0) if the first hand wins, (1) if the second hand wins, and (0, 1) for a draw.
Explained:
{
    # Map hands to best "played hand".
    .map({
        # Generate all combinations of length 1 to 4.
        .combinations(1..4)
        # Remove hands with repeated characters.
        .grep({!.join.comb.repeated})
        # Map to a cmp-arable representation. This works because
        # lists are compared element-wise. Translate some characters
        # so that ASCII order works. Sort in reverse order so that
        # element-wise comparison will go from highest to lowest.
        .map({ -$_, $_».trans('ATK'=>'1BZ')».ord.sort(-*) })
        # Find best hand.
        .min
    })
    # Return indices of lowest scoring hands. It's a shame that
    # `minpairs` doesn't support a filter like `min`.
    .minpairs».key
}

Out of interest how does <...> in your test harness translate to a list of strings? Is it some kind of sugar that says the content should be split on spaces?

@JonathanAllan This is Perl's word quoting. Perl 6 supports <a b c> in addition to qw(a b c) from Perl 5.

Well that's nice and golfy in of itself :)

Python 3, 207 204 bytes
lambda i,j:L(h(i))-L(h(j))if L(h(i))!=L(h(j))else(h(i)<h(j))-(h(i)>h(j))
L=len
def h(l):s=set();return[x[0]for x in sorted(y.translate({65:49,75:90,84:65})for y in l)if not(s&set(x)or s.update(*x))][::-1]

Try it online!
Saved 3 bytes thanks to Jonathan Frech
Returns 1 if the first hand wins, -1 if the second hand wins and 0 in case of a draw.
The function h computes a list that represents the hand.
The lambda compares two representations of hand. I think it might be shortened, but I wanted to return only three values and didn't find a simpler way to do comparison.

You can save two bytes by defining L=len and replacing all other occurrences of lenwith L.

Also, you can probably replace s=set() with s={0} and set(x)&s or with s&set(x)or

Jelly, 36 bytes
ẎŒQȦ;L;Ṗ€Ṣ$
“A+KYTE”yḲONŒPÇ€ṢṪµ€⁼€Ṁ$

A monadic link taking a list of two lists of characters
- each being a space separated representation of the hand (e.g. "Ac 2d 4s 3h")
returning a list of two numbers identifying the winner(s) with 1 and any loser with 0
- i.e. [1, 0] = left wins; [0, 1] = right wins; [1, 1] = draw.
Try it online! or see the test-suite.
How?
ẎŒQȦ;L;Ṗ€Ṣ$ - Link 1, sortKey: list of lists of numbers representing some cards (see Main)
Ẏ           - flatten into a single list of numbers
 ŒQ         - distinct sieve (1 at first occurrence of anything, 0 at the rest)
   Ȧ        - Any & All? zero if any are 0 or if empty; 1 otherwise (i.e. playable hand?)
     L      - length of input (number of cards in the hand)
    ;       - concatenate
          $ - last two links as a monad:
       Ṗ€   -   pop each (get just the rank portions)
         Ṣ  -   sort (Main's translation & negation of ordinals ensures A>2>3>...>Q>K)
      ;     - concatenate (now we have [isPlayable; nCards; [lowToHighCards]])

“A+KYTE”yḲONŒPÇ€ṢṪµ€⁼€Ṁ$ - Main link: list of lists of characters, hands
                  µ€     - for €ach of the two hands:
“A+KYTE”                 -   literal list of characters "A+KYTE" (compressing doesn't help - lower case would be “£Ḅṁ⁽>» though -- I'll stick with kyte though it's kind of nice.)
        y                -   translate - change As to +s, Ks to Ys and Ts to Es
                         -               note the ranks are now in ordinal order:
                         -               +<2<3<4<5<6<7<8<9<E<J<Q<Y
         Ḳ               -   split at spaces - split the four cards up
          O              -   to ordinals '+'->43, '2'->50, ...
           N             -   negate - effectively reverse the ordering
            ŒP           -   power-set - get all combinations of 0 to 4 cards inclusive
              Ç€         -   call the last link (1) as a monad for €ach such selection
                Ṣ        -   sort these keys
                 Ṫ       -   tail - get (one of) the maximal keys
                         -                       (the key of a best, playable selection)
                       $ - last two links as a monad:
                      Ṁ  -   maximum (the better of the two best, playable selection keys)
                    ⁼€   -   equals? for €ach (1 if the hand is a winner, 0 if not)

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Draw my downslashes
As a programmer, you've probably heard of forward slashes and backward slashes. But have you heard of downslashes? That's when you take a bunch of slashes, connect their ends and draw them going down.
For today's challenge, you must write a program or function that takes a string consisting purely of slashes, and outputs all of those slashes drawn downwards in a line connecting them. This will be a lot more clear if you see an example. Given the string \\\//\/\\, you should output:
\
 \
  \
  /
 /
 \
 /
 \
  \

Here are some clarifications:

There must be one slash per line.
The first line will have 0 leading spaces.
For each pair of slashes:

If they are different from each other, they will be drawn in the same column. For example, \/ will give:
\
/

If they are the same character, the lower one is in the direction pointed to, that is moving to the right for a backslash, and moving to the left for a forward slash. So \\// will give
\
 \
 /
/

Each line may have extra trailing whitespace as long as this doesn't change the visual appearance of the output. Up to one trailing and leading newline is also acceptable. Extra leading spaces are not permitted!

In order to keep this simpler, you can assume that the string will never contain too many forward slashes. In other words, no prefix of the input will contain more forward slashes than backslashes, so an input like \\//// or // will never be given. This also means that every input will start with a backslash.
If your input is taken as a string literal, you may escape the backslashes if this is necessary. You will also never need to handle an input that is empty, or contains characters other than a slash.
You may output by any reasonable format.
As usual, this is a code-golf challenge, so try to make the shortest solution possible, even if you pick a language where this is rather difficult. Bonus points for explaining any interesting techniques you used to take bytes off!
Examples
#Input
\\\\\\\\\\\

#Output
\
 \
  \
   \
    \
     \
      \
       \
        \
         \
          \

#Input
\\\//\\/\//\\///

#Output
\
 \
  \
  /
 /
 \
  \
  /
  \
  /
 /
 \
  \
  /
 /
/

#Input
\/\/\/

#Output
\
/
\
/
\
/

The backslashes make for an annoying amount of escaping lol...

Is the formfeed/backslash method of moving the cursor around given in my answer permissible for this question?

Can we output a list of lines?

@cairdcoinheringaahing That seems like a reasonable IO method to me

@totallyhuman try python’s raw string: r"/\\////\\/\/\/\\\\//////\/" needs no escaping for any of the slashes.

GNU Sed, 20
s|\\|&^L|g
s|/|^H/^L^H|g

Note that ^L and ^H are literal formfeed and backspace characters (0x12 and 0x8).
This answer works by moving the cursor around using backspace and formfeed characters.  The slashes/backslashes are not left-padded with spaces - Not sure of this disqualifies this answer.  This doesn't work in TIO, but it looks fine under common terminals such as xterm and gnome-terminal.
Recreate this sed script as follows:
base64 -d <<< c3xcXHwmDHxnCnN8L3wILwwIfGc= > downslash.sed

Run it as follows:
$ echo '\\\//\/\\' | sed -f downslash.sed
\
 \
  \
  /
 /
 \
 /
 \
  \

$

Explanation:
s|\\|&^L|g     # move cursor down after every "\"
s|/|^H/^L^H|g  # move cursor left before every "/", then after, down and left again

///, 119 bytes
/// has no input commands, so input must be embedded in the program. For this one, the input string is simply appended, with no escaping needed.
/=/\/\///M/
|%%=N/%|||=C/BA=\/\\/\/C\\=C\\/CbC=B\A\=CfC=AB=/A/%Mxy=B/|z%N|x|y% %N%x|y%%% |fzN%M%b|zN|M|%
=|/AB\\=%/|=AC

Try it online!
With -d option (program state shown in brackets before each command is run).

How it works

In the following, an input of \\/\// will be appended to the program for demonstration.
␤ is used to represent newlines in inline code.

Abbreviations
The beginning /=/\/\///M/␤|%%=N/%|||=C/BA= of the program contains substitutions for golfing abbreviations.

= expands to //, M to ␤|%%, N to %||| and C to BA.
After this the current program becomes
/\/\\/\/BA\\//BA\\/BAbBA//B\A\//BAfBA//AB///A/%
|%%xy//B/|z%%||||x|y% %%|||%x|y%%% |fz%|||%
|%%%b|z%||||
|%%|%
//|/AB\\//%/|//ABA\\/\//

Input recoding
The next stage transforms the appended input string into a more usable form. Since it consists entirely of ///'s two command characters, this takes some care to avoid mangling the base program.

The first substantial substitution, /\/\\/\/BA\\/, replaces the string /\ with /BA\.

The base program does not contain /\ at this time, so this substitution doesn't affect it.
However, this splits up the appended input string into sequences of \s followed by sequences of /s, which together with the ABA at the end of the base program makes it possible to iterate through it with the following substitutions.
Including the ABA prefix before it, the example input string now becomes ABA\\/BA\//.

The next substitution, /BA\\/BAbBA/, replaces BA\ by BAbBA.

Because /// substitutions are repeated until they no longer match, this iterates through all the \s of the input string, which with prefix now becomes ABAbBAbBA/BAbBA//

Similarly, /B\A\//BAfBA/ changes BA/ to BAfBA, iterating through the /s.

The escaping \ in this substitution is needed since otherwise it would be mangled by the previous one.
The input has now turned into ABAbBAbBAfBABAbBAfBAfBA.

Next /AB// removes some superfluous parts of the encoding, turning it into AbBAbBAfBAbBAfBAfBA.

This also removes an AB from the /|/AB\\/ substitution later in the program, which was needed to protect it from the above /\ manipulation.
At this point every \ in the original input string has become AbB, and every / has become AfB. (b and f stand for backward and forward.) There's a stray A at the end.

The next two substitutions replace all the As and Bs with program fragments to run in the final stage. In the replacement strings, %s and |s encode what will become /s and \s respectively. This has two benefits:

Unlike / and \, the %s and |s don't need escaping to be copied.
The replacement strings avoid containing the substring /\, which would otherwise have been mangled by the previous manipulations.

After this, the substitution /|/\\/ (formerly /|/AB\\/) now decodes the |s, after which the following /%/|// has become /%/\// and decodes the %s.

Program structure at final stage
At this point, the base program has run all its substitutions, and all that remains is the program-encoding of the input string.

Each input character has become a subprogram
/
\//xy*\z//\\\\x\y/ //\\\/x\y/// \fz/\\\/
\///b\z/\\\\
\//\/

(trailing newline), where * represents either f for an original /, or b for an original \.
There is also an incomplete substitution command /␤\//xy at the end of the program, which will have no effect except to provide a necessary / for the substitutions of the previous subprogram.

Shared substring
Before the final iteration through the subprograms starts, there is a substring crossing the boundary after each character's subprogram of the form \/␤/.

These substrings are used as a shared global state. All the remaining substitutions in the program will manipulate them identically and in parallel, such that at the end of each input character's subprogram its copy of this shared substring (except the final /, which anchors the substitutions) will be run to print the line for that character.
The initial version of the substring represents printing a line containing just /, which is the right imaginary "previous line" to cause the first input character to be printed at the beginning of its line.
In general, during the printing steps, the shared substring consists of a number of spaces, \\ or \/, a newline, and a following /.

Running a character subprogram
Several of the following substitutions contain extra \s inside to prevent them from being matched and mangled by each other (including other copies in other subprograms). Achieving this is also the reason why both of x and y are needed.

The first substitution in a character subprogram, /␤\//xyf\z/ or /␤\//xyb\z/, causes the ␤/ at the end of the shared substring to become xyfz or xybz, immediately following the \/ or \\.
The substitution /\\\\x\y/ / replaces \\xy by a space, and the substitution /\\\/x\y// replaces \/xy by nothing.

They apply when the previous input character printed was a \ or /, respectively.
The shared substring now contains the appropriate number of spaces for printing a \ next, followed by fz or bz.

The substitution / \fz/\\\/␤\// replaces  fz by \/␤/, and /b\z/\\\\␤\// replaces bz by \\␤/.

They apply when the current input character is / or \, respectively.
The first one eats an extra space to place / correctly.

If this space is missing (i.e. input violating the prefix condition), the following substitutions get misinterpreted, printing a lot of junk and usually hitting a ///, which is an infinite loop.

Each adds the correct command to print its own character, and reinstates the original ␤/ at the end of the shared substring.

The character subprogram has now reached its copy of the shared substring, which is ready to print its line.

After the last character subprogram has run, what remains of the program is /␤\//xy. Since this is an incomplete substitution with missing final /, the program skips it and halts normally.

The right language for the job! Lol

Python 2, 55 54 51 57 53 bytes
-3 bytes (and a bug fix) thanks to Felipe Nardi Batista

i=0
for c in input():i-=c<'<'*i;print' '*i+c;i+=c>'<'

Try it online!

56 bytes

Charcoal, 13 12 11 bytes
ＦＳ¿⁼ι/↓¶/↘ι

Try it online! Link is to verbose version of code. Supports extra //s. Explanation:
 Ｓ              Input string
Ｆ               Loop over each character
  ¿             If
    ι           Current character
   ⁼            Equals
     /          Literal /
      ↓¶        Move left
      ↓ /       Print a / downwards
         ↘ι     Else it's a \ so print that down and right

I think ↓¶ = "Move left" in the description isn't right.

@JonathanAllan That's right (newline printed down = move left), although it would probably be clearer to say "print \n/ down"

I didn't say print \n/ down because I felt that it was more helpful to describe the effect of the code rather than its literal translation.

(Tongue in cheek: Describing the effect = MyCode - Do the spec). I get it now though the effect is to move left; might be worth saying "Move left (by printing a newline with a downward printing direction)".

Most concise and self-explanatory of all!

10 bytes: ＦＳ≡ι/↓¶/↘ι (Answer is too old for me to bother editing it.)

Jelly,  14 13  12 bytes
-1 thanks to caird coinheringaahing (Use of ;" in place of ż to allow yielding a list of lines and so use of Ʋ.)
=”\Ḥ’Ä_Ʋ⁶ẋ;"

A monadic Link that yields a list of lines.
Try it online!
How?
=”\Ḥ’Ä_Ʋ⁶ẋ;" - Link: list of characters, s    e.g. "\\\//\\/"
 ”\          - literal '\'                         '\'
=            - equal? (call this e)                [1, 1, 1, 0, 0, 1, 1, 0]
       Ʋ     - last four links as a monad - f(e)
   Ḥ         -   double (e)                        [2, 2, 2, 0, 0, 2, 2, 0]
    ’        -   decrement                         [1, 1, 1,-1,-1, 1, 1,-1]
     Ä       -   cumulative sums                   [1, 2, 3, 2, 1, 2, 3, 2]
      _      -   subtract (e)                      [0, 1, 2, 2, 1, 1, 2, 2]
        ⁶    - literal ' '                         ' '
         ẋ   - repeat                              ["", " ", "  ", "  ", " ", " ", "  ", "  "]
           " - zip with:
          ;  -   concatenate (c from s)            ["\", " \", "  \", "  /", " /", " \", "  \", "  /"]

11 bytes, outputting as a list of lines, as allowed by OP

I didn't do that because it doesn't create a list of lines and I can't think of a 12 that does...

12 that does

So it does - I mentally rejected ;" as doing the same as ż but of course, it doesn't >.< - thanks!

Haskell, 49 bytes
scanl(\x c->drop(sum[1|'/'<-c:x])(' '<$x)++[c])[]

Try it online!

MATL, 23 19 18 bytes
1 byte off thanks to @Sanchises
fGqoEq1yd~h*YsGZ?c

Input is a string enclosed in single quotes.
Try it online! Or verify test cases: 1, 2, 3.
Explanation
Consider input '\\\//\/\\' as an example.
f      % Implicit input. Array of indices of nonzeros. Since all chars in the input
       % have nonzero code point, this gives [1 2 ... n] where n is input length
       % STACK: [1 2 3 4 5 6 7 8 9]
G      % Push input again
       % STACK: [1 2 3 4 5 6 7 8 9], '\\\//\/\\'
qo     % Subtract 1 from (the code-point) of each char and then compute modulo 2.
       % This transforms '\' into 1 and '/' into 0
       % STACK: [1 2 3 4 5 6 7 8 9], [1 1 1 0 0 1 0 1 1]
Eq     % Double, subtract 1. This transforms 0 into -1
       % STACK: [1 2 3 4 5 6 7 8 9], [1 1 1 -1 -1 1 -1 1 1]
1y     % Push 1 and duplicate from below
       % STACK: [1 2 3 4 5 6 7 8 9], [1 1 1 -1 -1 1 -1 1 1], 1, [1 1 1 -1 -1 1 -1 1 1]
d~     % Consecutive differences, logical negation: gives 1 if consecutive entries
       % are equal, 0 otherwise
       % STACK: [1 2 3 4 5 6 7 8 9], [1 1 1 -1 -1 1 -1 1 1], 1, [1 1 0 1 0 0 0 1]
h      % Horizontally concatenate
       % STACK: [1 2 3 4 5 6 7 8 9], [1 1 1 -1 -1 1 -1 1 1], [1 1 1 0 1 0 0 0 1]
*      % Element-wise multiplication
       % STACK: [1 2 3 4 5 6 7 8 9], [1 1 1 0 -1 0 0 0 1]
Ys     % Cumulative sum
       % STACK: [1 2 3 4 5 6 7 8 9], [1 2 3 3 2 2 2 2 3]
G      % Push input again
       % STACK: [1 2 3 4 5 6 7 8 9], [1 2 3 3 2 2 2 2 3], '\\\//\/\\'
Z?     % Build sparse matrix with those row indices, column indices, and values
       % STACK: [92  0  0;
                  0 92  0;
                  0  0 92;
                  0  0 47;
                  0 47  0;
                  0 92  0;
                  0 47  0;
                  0 92  0;
                  0  0 92]
c      % Convert to char. Char 0 is shown as space. Implicitly display
       % STACK: ['\  ';
                 ' \ ';
                 '  \';
                 '  /';
                 ' / ';
                 ' \ ';
                 ' / ';
                 ' \ ';
                 '  \']

One byte off by a slightly different algorithm to get your indices: Try it online!

@Sanchises Thanks for your very appropriate edits!

JavaScript (ES8), 66 59 63 bytes
7 bytes saved thanks to Justin Mariner
+4 bytes to fix /\\/\\/ (noticed by Neil)
f=([a,...z],b=a<'0')=>a?a.padStart(b+=k=a>'/')+`
`+f(z,b-!k):''

Try it online!

Perl 5, 44 bytes
42 bytes of code + 2 for -F flag
say$"x($s+=$\eq$_&&$#i**m|/|).($\=$_)for@F

Try it online!

05AB1E, 14 bytes
ÇÈx<ηOs-W-ISú»

Try it online!
Explanation
Ç                # convert input string to a list of ascii codes
 È               # check each for evenness
  x              # push a doubled copy
   <             # decrement
    η            # compute prefixes
     O           # sum each prefix
      s          # swap the unaltered copy of evenness to the top
       -         # subtract from the prefix-sum list
        W-       # subtract the minimum value
          IS     # push input split to a list of chars
            ú    # pad each with the number of spaces computed
             »   # join on newline

Doesn't work for /\\/\\/.

Ç¥.¥0<.SηOv¹Nèy<ú, sobbing in binary

Well done!

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

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

Try it online!
Explanation for 77 byte answer:
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
        )
    )

Doesn't work for /\\/\\/.

@Neil thank you for pointing that out! Fixed.

I know it's been a while, but you can save a byte by changing s.Take(i).Sum(y=>y<92?-1:1)+(x-s[0])/45+1 to (x-s[0])/45-~s.Take(i).Sum(y=>y<92?-1:1)

Nice one @KevinCruijssen !

Brain-Flak, 175 bytes (174 chars + 1 flag)
Run with -c flag.
{(({})<(())>){({}[()]<([{}])>)}{}(({}<>{}<><({}<>)((()()()()()){})>)<{({}[()]<((((()()()()){}){}){})>)}>{})<>}<>{}{({}<>)(({})(())){({}[()]<([{}]())>)}{}{<>{}<>(<{}>)}{}<>}<>

Try it online!
Explanation
{ for each char in the input...
  (({})<(())>){({}[()]<([{}])>)}{} push 1/-1 for backslash/slash
  ((
   {}<>{}<> add the 1/-1 to a running total
   <
    ({}<>) move slash/backslash to other stack
    ((()()()()()){}) newline
   >
  )<{({}[()]<((((()()()()){}){}){})>)}>{}) spaces
  <>
}<>{} end for
reverse data order, removing one space before backslash
{({}<>)(({})(())){({}[()]<([{}]())>)}{}{<>{}<>(<{}>)}{}<>}<>

I always upvote brain-flak. :D

Ruby, 80 76 bytes
-4 bytes thanks to manatwork
puts"\\";$*[i=0].chars.each_cons 2{|b,c|puts" "*(b==c ?b==?/?i-=1:i+=1:i)+c}

Try it online!
Explanation:
puts "\\"           # Output the first backslash
$*[i=0].            # Get the first argument and set i to 0
chars.              # Go through every individual character,
each_cons 2 { |b,c| # In pairs to compare easily
                    #
    puts " " *      # Decide how many padding spaces to use based on the value
                    # of i. The expression inside the parenthesis will return
                    # i but before that, it will increment/decrement i based
                    # on what the previous character was.
                        #
    ( b==c ?            # if b == c
        b==?/ ?         #   if b == "/" (Going to the left)
            i-=1        #       return decremented i
            :           #   else        (Going to the right)
            i+=1        #       return incremented i
        :               # else
        i) +            #   return i
                    #
                c   # Finally, write the second of the characters that we're
}                   # iterating through.

Which Ruby version? The 2.3.3 I have demands parenthesis around parameter when code block follows: .each_cons(2){…}. In change you can save by replacing .each_char → .chars.

@manatwork My ruby version is 2.4.1. Thanks for the suggestion about chars, I didn't know about that one.

You can save another two bytes by moving i+= to the beginning of the nested ternary expression, and ending it with -1:1:0.

C, 60 bytes
i;f(char*s){for(i=1;*s;s++)printf("%*c\n",*s%2?--i:i++,*s);}

Try it online!

TIO

@ASCII-only you're welcome

Lua, 96 bytes
c=0 for s in(...):gmatch(".")do c=c+(p==s and(s=="/"and-1or 1)or 0)p=s print((" "):rep(c)..s)end

Try it online!
Shortest one I could come up with in Lua. Input is taken from the command line.
This does use a few tricks:

(...):gmatch(
This should be the shortest form of getting a single string into a Lua program from the command line. The ... expression in Lua captures any excess parameters to a function that aren't specified in the function declaration and is used for varargs. Since the main body of a Lua program gets called as a function with the command line arguments as its parameters, the command line arguments will end up in ....
The parentheses around it turn the potentially multi-valued ... expression into a single-valued expression. Consider this (somewhat surprising) example:

function multipleReturnValues()
    return "abc", "def"
end
print(  multipleReturnValues()  ) --This prints: abc    def
print( (multipleReturnValues()) ) --This prints: abc
The Lua parser does not need any line terminators, or even whitespace between statements, as long as the two statements' tokens can be clearly separated and there's only one interpretation of the text that's valid Lua code.
Abusing and/or for "if x then value1 else value2" logic.
Lua's and operator returns its first argument if it is falsy; otherwise, it returns its second argument. The or operator returns its first argument if it is truthy; otherwise, the second argument.
pdoesn't need any initialization.
p==s always has to be false in the first run of the loop, regardless of the input. Not setting p to any value before entering the loop (leaving it nil) will make that happen and save bytes, too.

Can anyone golf this (in Lua)?

I was able to save two bytes by using gsub instead of using gmatch. c=0(...):gsub(".",function(s)c=c+(p==s and(s=="/"and-1or 1)or 0)p=s print((" "):rep(c)..s)end)

Well, not that it matters. You could've easily saved two bytes by changing gmatch(".") to gmatch"." like you did in your next answer.

@QuertyKeyboard That's weird... I actually used gsub exactly like this in the first version of this code, but then switched to gmatch instead because it somehow turned out shorter. I don't know what I did different though, the file is overwritten unfortunately.

Retina, 47 bytes
^|\\
 $&
+m`^( *)( /|\\)(/| \\)
$1$2¶$1$3
m`^

Try it online! Link includes test cases. Explanation:
^|\\
 $&

Add a space at the beginning of each line and before each \.
+m`^( *)( /|\\)(/| \\)
$1$2¶$1$3

Consider the first two characters of the string. If the first is a / then the indent needs to be decremented; this is achieved by including the preceding space in the capture (which always exists because the first stage added it); if the second is a \\ then it needs to be incremented; this is achieved by including the space that the first stage added in the capture. Having given the second character the correct indent, the stage is repeated for the second and third character etc.
m`^

Remove the extra indent.
I've written a 94-byte version which (like my Charcoal answer) allows any combination of slashes: Try it online! Explanation:
.$
¶$.`$* $&

Get the ball rolling by taking the last slash and indenting it to the same position on its own line.
/
 /

Prefix spaces to all forward slashes so that they can be captured.
+`^(.*)( /|\\)¶( *)( \\|/)
$1¶$3$2¶$3$4

Repeatedly take the last slash of the input and align it on its own line with the slash on the line below.
+ms`^(?<!^[\\/].*) (?!.*^[\\/])

Delete any left-over indentation.
G`.

Delete the now empty input.

C (GCC), 137 134 97 bytes
Try it online!
• 3 bytes thanks ATaco
• 37 bytes thanks to  Digital Trauma & ThePirateBay
i,d;f(char*s){char c=s[i],n=s[++i];if(c){printf("%*c%c\n",d+1,c);(c-n)?d:(c==47)?--d:++d;f(s);}}

Nothing too fancy just a simple recursive function that takes a string and prints out the slashes, note that the input needs to escape the backslashes first.
Usage
f("\\\\\\//\\/\\\\",0,0);

Ungolfed
This is for the old answer, view the try it online link for updated one!
f(char *s, i, d) {
    char c=s[i], n=s[++i];
    if(!c) return;
    for(int j=0; j<d; j++) printf(" ");
    printf("%c\n",c);
    f(s, i, (c!=n)?d:(c=='/')?d-1:d+1);
}

Output

You can replace c=='\0' with !c for the same effect.

Awesome thanks just updated the solution!

Can you use printf("%*s%c", n, "", c) to print the the char c with n leading spaces?

I'm pretty sure you can save few bytes by replacing (c!=n) with c-n and rearranging ternary expressions. Same with (c=='/'). Also, you can replace '/' with literal number 47. I think it is 7 bytes in total.

The function signature is invalid

78 bytes

@ThePirateBay Can you help me golf it :P

78 bytes, fancier output

@ASCII-only. 72 bytes. Always use - instead of ==. Here is even better situation, because we can do bit hacking.

@ThePirateBay Oh true lol

@ThePirateBay & Digitial Trauma thanks I updated my answer!

@ASCII-only My C answer is only 60 bytes :)

Java 8, 121 118 110 109 102 bytes
a->{String r="";int s=0,p=0,i;for(char c:a){for(i=s+=p+(p=c-63)>>5;i-->0;r+=" ");r+=c+"\n";}return r;}

-7 bytes thanks to @Nevay's bit-wise magic. :)
Explanation:
Try it here.
a->{                    // Method with char-array parameter and String return-type
  String r="";          //  Return-String
  int s=0,              //  Amount of spaces
      p=0,              //  Previous characters (starting at 0)
      i;                //  Index-integer
  for(char c:a){        //  Loop over the input
    for(i=s+=p+(p=c-63)>>5;
                        //   If the current does not equals the previous character
                        //    Leave `s` the same
                        //   Else-if it's a '\':
                        //    Increase `s` by 1
                        //   Else (it's a '/'):
                        //    Decrease `s` by 1
                        //   And set the previous character to the current in the process
        i-->0;r+=" ");  //   Append `r` with `s` amount of spaces
    r+=c+"\n";          //   Append the character + a new-line to the result
  }                     //  End of loop
  return r;             //  Return result-String
}                       // End of method

102 bytes: a->{String r="";int s=0,p=0,i;for(char c:a){for(i=s+=p+(p=c-63)>>5;i-->0;r+=" ");r+=c+"\n";}return r;}

@Nevay Thanks. I knew it could be shortened with some bitwise operations, but couldn't figure it out. Mainly because I forgot about trying the effects of >>/>>>/<<... I had only checked some things with &/|/~/^..>.>

R, 122 121 bytes
-1 byte thanks to Giuseppe
x=el(strsplit(scan(,""),""));n=seq(x);y=x>"/";for(i in n)cat(rep(" ",diffinv(y[n[-1]-1]+y[n[-1]]-1)[i]),x[i],"\n",sep="")

Try it online!
With extra whitespace:
x = el(strsplit(scan(,""),""))
n = seq(x)
y = x>"/"
for(i in n) {
  cat(rep(" ", diffinv(y[n[-1]-1]+y[n[-1]]-1)[i]), x[i], "\n", sep="")
}

Explanation: This answer is based on the observation that the number of leading spaces changes each line by -1, plus the number of / in the previous and current lines.
If we have N slashes, the variable y is a vector of length N, with 1 for each position with \, 0 otherwise. Therefore, to get the change in number of leading spaces per line, we calculate y[1:(N-1)] + y[2:N] - 1. The function diffinv converts these differences into a sequence, starting with 0. The rest is just a matter of assembling each line as the required number of trailing spaces, followed by the relevant slash and a newline.

huh. I took a quite different approach for 119 bytes which makes me wonder if we could combine our approaches. (nice use of diffinv ;) Also you can set y=x>")" for -1 byte

@Giuseppe You should post that as a separate answer, it's a different enough approach. Yours is a nice way of avoiding having to do strsplit, which is always a killer. You can also make use of the famous diffinv!

Also I think if you put library(methods) in the header (which should be OK w/o penalty since that package is part base R), you can use el. Also, diffinv turned out to be just as long as cumsum! :)

Yes, I was just realising that too, it doesn't quite work in that context

well, I came up with a workaround, but yeah, that *S screws things up.

brainfuck, 98 bytes
++++++++[->++++<]<<<,[[->+++++++++++<<+>]>-----[>+>+<<[-]]>-[->>.<+<]>[-<+>]<<<<.[-]>++++++++++.,]

Try it online!

Vyxal, 16 bytes
ƛ\/=&-ð¥*n+,C₂&+

Try it Online!
ƛ                # Map by...
    &-           # Decrement register by
 \/=             # (is a forward-slash)
      ð¥*        # (register) spaces
         n+,     # prepended to n and outputted
              &+ # Increment register by
            C₂   # (is a backslash)

R, 119 bytes
function(s)for(i in 1:nchar(s))cat(rep(" ",cumsum(c(0,!diff(S<-(utf8ToInt(s)>48)*2-1))*S)[i]),substr(s,i,i),"
",sep="")

Try it online!
This differs somewhat from user2390246's answer. They each iterate over the string, printing out a certain number of space characters and then the appropriate /\ character.
However, I avoided splitting the string, opting instead to replace the characters with their UTF-8 encoding value instead, which then allows me to do arithmetic on the numbers directly, which saved me just a few bytes.

Just been pondering this some more, I think there is an error in your algorithm: TIO

@user2390246 I fixed it! I had some misplaced parentheses, but now the diffinv definitely won't work here.

what about https://tio.run/##HYy7DsIwEAR/xaS6i2yZJBQpAj11QkUokMlJV8QOfkj@e2MxxUo7K60vJK6FkjWRnYWA5DywYCvC9oU8qRRpXNzdxrohmncEtnFxj6rBgN8OGHpp0h7SXvtZnj5MBPOkIN8uI7a96hDbGZ/8Qplrym6oR4WgWSt6/aO1brD8AA

Lua, 88 84 bytes
Improved version (-4 bytes thanks to QuertyKeyboard)
s=""g=s.gsub g(...,".",function(c)s=g(g(g(s,"\\"," "),"/?$",c)," /","/")print(s)end)

Try it online!
Original version (88 bytes)
Another attempt in Lua, this time with a completely different approach using string manipulation instead of a counter variable.
s=""for c in(...):gmatch"."do s=s:gsub("\\"," "):gsub("/?$",c):gsub(" /","/")print(s)end

Ungolfed:
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

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:
(...):gmatch"."
-> (...):gmatch(".")
-> string.gmatch((...), ".")
If anyone can think of a way to remove one of the three gsub calls, please tell me.

I was disappointed to find that my gsub trick I commented in your other answer didn't quite work for this one. It actually ended up adding one byte. However, I wouldn't give up that easily. First, I tried to store gsub as a variable to shorten the code. To my surprise, my code was exactly the same amount of bytes - 88. However, I realized that with gsub being saved, my gsub trick could now work! Here's my code that shaved off 4 bytes: s=""g=s.gsub g(...,".",function(c)s=g(g(g(s,"\\"," "),"/?$",c)," /","/")print(s)end)

@QuertyKeyboard Yup, I also tried storing gsub in a variable before the loop and then using it instead of writing gsub three time, and I was just as surprised to see it making absolutely no difference. Combining the "gsub instead of loop" and "store gsub" tricks is really neat, didn't think of that one! Thanks! :)

C# (.NET Core), 60/65 bytes
I tried shorter C# version
s=>{int i=0;return s.Select(x=>"".PadLeft(x<92?--i:i++)+x);}

as there was stated: "This also means that every input will start with a backslash."
Or slighly longer which solve starting "/"
s=>{int i=s[0]&1;return s.Select(x=>"".PadLeft(x<92?--i:i++)+x);}

Try it online!

Welcome to the site! :)

Pyth, 28 bytes
j.u+?qeNY?>Y\/+PNdPPNPNYtzhz

Try it online!

You can save a byte by using Q instead: j.u+?qeNY?>Y\/+PNdPPNPNYtQh.

26 bytes

Dyalog APL, 31 bytes
{↑⍵,¨⍨' '/¨⍨{⍵-⍨+\¯1+2×⍵}⍵='\'}

Try it here!

{↑⍵↑¨⍨a-1-+\¯1*a←⍵='\'}

QBasic, 79 bytes
DO
c$=INPUT$(1)
IF"/">c$THEN END
c=2*ASC(c$)-139
i=i+c+p
?SPC(i\90);c$
p=c
LOOP

This program prints the slashes as you type them. To quit, press Enter (or anything earlier in the ASCII table than /).

Explanation
With the variables i and p implicitly initialized to 0, we enter an infinite loop. INPUT$(1) reads one character from keyboard input. If this character is less than forward slash, END the program. Otherwise, we calculate c such that an input of / gives c=-45 and \ gives c=45. We then add c and p (the previous value) to i (the indent).
If p and c are the same, they add together to change i by either -90 or +90. If they are different, they cancel out and do not change i. We then print i\90 spaces followed by the character. (We use integer division because the value of i is actually going to be 45, 135, etc., since p is 0 on the first iteration instead of -45.)
Finally, set p=c for the next iteration, and loop.

Perl, 33 bytes
Includes +1 for the n option
perl -nE 's%.%say$"x(l^$&?--$a:$a++).$&%eg' <<< '\\\//\/\\'

Where it not for the fact that -F counts as +3 this would be 32:
echo -n '\\\//\/\\' | perl -F -E 'say$"x(l^$_?--$a:$a++).$_ for@F'

Zsh, 43 bytes
for c (`fold -1`)echo ${(l/#c%2?w--:++w/)c}

Try it online!
Explanation:

fold -1: line-wrap the input to a width of 1 (i.e., insert a line-break between every character)
for c (``): for each character $c:

${c}: take the character,
(l//): left-padded with spaces to the width of:

#c: the character code of $c
%2: modulo 2 (this is 1 for / and 0 for \)
?: if 1 then:

w--: decrement $w (and return the original value)

:: else:

++w: increment $w (and return the mutated value)

note that $w starts at 0 implicitly

echo: print; we can't use the 2 bytes shorter <<< since its argument is evaluated in a sub-shell so the mutation of $w has no effect

Pyth, 24 21 bytes
Port from Rod's answer.
VQ=-Z<N\<+*ZdN=+Z>N\<

Try it online!

Invalid, prints [extra leading space on the first line if the string starts with \. BTW where is your code?

@Mr.Xcoder fixed

VBA (Excel), 181 bytes
Sub q()
a = Cells(1, 1)
For x = 1 To Len(a)
c = Mid(a, x, 1)
If c = "\" Then: Debug.Print b & c: b = b + " "
If c = "/" Then: b = Left(b, Len(b) - 1): Debug.Print b & c
Next
End Sub

You can golf this down significantly without changing your algorithm by taking advantage of the autoformatting nature of Excel VBA and by use of [...] notation: I got it down to 128 Bytes  Sub q
For x=1To[Len(A1)]
c=Mid([A1],x,1)
If c="\"Then Debug.?b;c:b=b+" "
If c="/"Then b=Left(b,Len(b)-1):Debug.?b;c
Next
End Sub

Thank you for golfing my script. I learned something from this and will apply in the future. :) Didn't know I can use that to fetch data directly to the cells. Thanks again :)

SOGL V0.12, 16 13 bytes
{└=-:↕PFoF┘=+

Try it Here! - expects input on the stack, so for ease-of-use , is added

Pyth - 33 bytes
First attempt, will golf.
jsMC,*L;+ZsM._*VqVtzztMxL"/ \\"zz

Try it online here.

my first attempt 32 bytes

second attempt 28 bytes

third attempt 26 bytes

pinged @maltysen

@StanStrum at this point, u can just post it as your own answer

right mate see you there

V, 14 bytes
\ÓçÜ/j>G
ç¯/<G

Try it online!

Perl, 40 + 2 bytes
/\//&&$.--,say($"x$.,$_),/\\/&&$.++for@F

You need the -F flag.

Perl, 34 38 + 1  bytes
to handle the two cases
s,(/)|.,$"x($1?$c&&--$c:$c++).$&.$/,ge

to be run with -p option
s,(/)|.,$"x($1?--$c:$c++).$&.$/,ge

EDIT: following comment doesn't work when first character is /
s,(/)|.,$"x($1?$c--:++$c).$&.$/,ge

however output will be shifted one character on the right if first char is \

Doesn't work for /\\/\\/.

With the updated question your original 34 solution is now perfectly valid

Implicit, 25 bytes
~.(´?`/ò](0ß´);@ß1?`\ó~.ö

Try it online!
Ungolfed/explanation:
~.         read input, increment
(          do..while top of stack truthy
 ´         decrement

 ?`/{      if input equal to /
   ]´[      decrement memory
 }

 ](0       pull memory, do..while truthy
  @32       print a space
  ´         decrement
 );        pop

 @@10      print input, print a newline

 ?`\{      if input equal to \
   ].[      increment memory
 }

 ~.        read input, increment
)          loop
&          exit (avoid implicit output)

Note that ß is equal to @32, ò is equal to ]´[, ó is equal to ].[, and ö can be used in place of )& when at the end of a program.

Excel VBA, 74 72 Bytes
Anonymous VBE immediate window function that takes input from cell [A1] and outputs to the VBE immediate window
For i=1To[Len(A1)]:c=Mid([A1],i,1):s=s+(c="/"):?Spc(s)c:s=s-(c="\"):Next

Example I/O
[A1]="\\\//\\/\//\\///"
For i=1To[Len(A1)]:c=Mid([A1],i,1):s=s+(c="/"):?Space(s)c:s=s-(c="\"):Next
\
 \
  \
  /
 /
 \
  \
  /
  \
  /
 /
 \
  \
  /
 /
/

Python 3, 78 bytes
a,x='',0
for i in input():x+=((1*i!='/')-(1*i=='/'))*(a==i);print(' '*x+i);a=i

Try it online!

PowerShell, 71 69 bytes
-2 bytes thanks to mazzy
$z=92
$args|%{$i+=($x=2*($_-eq92)-1)*($z-ne$_)
' '*$i+($z=$_)
$i+=$x}

Try it online!
Takes input by splatting. This also saves us two bytes because we can just treat it as an int instead of writing '\' which we do twice.

nice. ($x=2*($_-eq92)-1) ?

PowerShell, 47 bytes
switch($args){'\'{' '*$i+++$_}'/'{' '*--$i+$_}}

Try it online!

brainfuck, 151 bytes
>->++++[>++++++++<-]>>+[[-]>[-]>,[<+<+>>-]<<[>++++>-[<->-----]+<[<<<<+[>+<-]>[<+>>.<-]>>>>-]>[<<<<<[>+<-]>[<+>>.<-]->>>>->]<<<.>>>++++++++++.[-]>]<<<<]

Try it online!

C (gcc), 96 71 70 bytes
Awesome -25 solution by ceilingcat
And another -1 by ceilingcat. ASCII bit hacks ftw
c;p;main(i){for(;read(0,&c,1);printf("%*c\n",i,p=c))c-p?:c&1?--i:++i;}

Try it online!
Ungolfed
c; /* character */
p; /* previous character */

main(i /* indent */)
{
    for (; read(0, &c, 1); printf("%*c\n", i, p = c))
        c - p ? : c & 1 ? --i : ++i;
}

Explanation
read takes 1 byte from the file descriptor 0 (stdin) and stores it in c.
c - p checks if c and p are different. c & 1 checks if c is a forward slash. So the entire conditional increments the indent if the character and the previous character are both backslashes, and decrements the indent if they're both forward slashes.
Then we print c with i leading spaces. We also assign p = c for the next iteration.

J, 28 27 22 bytes
({."0~+/\-0&<)_1^'\'=]

Try it online!
Thanks to Bubbler for catching a bug and for -6 bytes!

I think first column is truncated? Fixing it and using _1^ gives 27 bytes.

Thanks.  The _1 trick is more elegant anyway.

I got it down to 22 bytes.

There is golfed... and then there is Bubbler-ed!

Rockstar, 110 92 90 bytes
listen to S
cut S
Y's -1
while S
roll S in C
let Y be+C's "\"
say " "*Y+C
let Y be-C's "/"

Try it here (Code will need to be pasted in)
listen to S     :Read input string into variable S
cut S           :Split into an array
Y's -1          :Initialise Y as -1
while S         :While S is not empty
roll S in C     :  Pop the first element into variable C
let Y be+       :  Increment Y by
  C's "\"       :    C is equal to "\"
say " "*Y+C     :  Output Y spaces & C
let Y be-       :  Decrement Y by
  C's "/"       :    C is equal to "/"

Excel, 125 bytes
=LET(q,SEQUENCE(LEN(A1)),x,MID(A1,q,1),REPT(" ",MMULT(IF(TRANSPOSE(q)>q,,1),IF(q=1,,(INDEX(x,q-1)="\")-(INDEX(x,q)="/"))))&x)

Link to Spreadsheet
This is a port of Taylor Scott's VBA answer.
Explanation

=LET(q,SEQUENCE(LEN(A1)), q = vertical array [1..LEN(A1)]
x,MID(A1,q,1), x = The characters in A1 in a vertical array
IF(q=1,,(INDEX(x,q-1)="\")-(INDEX(x,q)="/")) the change in the number of spaces from the prior line; +1 if the prior line was "", -1 if the current line is "/"
IF(TRANSPOSE(q)>q,,1) a lower triangular matrix of 1s
MMULT(~,~) matrix multiply the change array and the lower triangular matrix to get the number of spaces for each line
REPT(" ",~)&x) for each line output the number of spaces & characters

Pyth, 20 bytes
jm?qd\\+*;~hZd+*;=tZ

Test suite
The other two existing Pyth answers use different approaches (and an older version of the language).
Explanation:
jm?qd\\+*;~hZd+*;=tZ   | Full program
jm?qd\\+*;~hZd+*;=tZdQ | with implicit variables added
-----------------------+------------------------------------------------
 m                   Q | For each character d in the input:,
  ?qd\\                |  if d is '\',
        *;             |   create a string of n spaces, where n is
          ~hZ          |    Z, but then store Z + 1 in Z (Z begins as 0)
       +     d         |   add d to the end of the string
  ?                    |  otherwise,
              +*;   d  |   do the same, but with (below) spaces
                 =tZ   |    Z - 1, stored in Z
j                      | Join the results by newline.

The test suite's input is missing a trailing ".

@JonathanAllan thanks for the heads up

Julia 1.0, 67 bytes
s->(x=[s...];@.println(lpad(x,$cumsum(1-2(x<'0')-[0;$diff(x)]%2))))

Try it online!

-3 bytes thanks to @MarcMush: replace isodd(_) with (_.%2)
-6 bytes thanks to @MarcMush: use @. to vectorize multiple expressions
-3 bytes thanks to @amelies: replace string repeats with lpad
-1 byte thanks to @MarcMush: replace 'x=='/' with x<'0'

I think you can use .%2 instead of isodd

Also maybe a @. instead of all the broadcasting

72 bytes using lpad and removing one *: s->(x=[s...];@.println(lpad(x,$cumsum(1-2(Int(x)%2)-[0;$diff(x)]÷45))))

You can use x<'0' instead of x=='/'

Vyxal, 8 bytes
Cæ:d⌐¦+↳

Try it Online! Outputs as a list of lines, formatting in footer
C        # Charcodes: "/" -> 47, "\" -> 92
 æ       # Are prime? "/" -> 1, "\" -> 0
   d⌐    # Double and take one's complement "/" -> -1, "\" -> 1
     ¦   # Cumulative sums
      +  # Add...
 æ:      # Is prime? (indents "/" by one extra space)
       ↳ # Pad to these lengths

are you literally trying to make this slow? ∷ is much faster than a primality test :p

Rust, 165 bytes
fn f(s:&str){let(_,a)=s.chars().fold((0,"".to_string()),|(i,r),c|(if c<'<'{i-1}else{i+1},format!("{}{}{}\n",r," ".repeat(if c<'<'{i-1}else{i}),c)));println!("{}",a)}

Try it online!
It's an adaptation of Rod's answer in Python 2.

c64 basic v2, 71 70 61 bytes
1rEs:x=1024:fOy=1tolE(s):a=aS(mI(s,y,1)):pOx,a:x=x-165+a*2:nE

Input can be given as
0dA"\\/\/\\/\//"

If the string is longer as 25, the program will overwrite its own memory. And we won't do that, because basic programs overwriting themselves with POKEs contradict the OO paradigm.

Python 2, 86 76 75 bytes
-1 byte thanks to Neil.
p,i='',0
for c in input():i+={'\\\\':1,'//':-1}.get(p+c,0);print' '*i+c;p=c

Try it online!
Fairly lame approach, I will try to golf the mapping at least. NVM I got rekt by another answer. >_>

GolfScript - 117 bytes
1/{'/'=}%1:s;[{s}{..(\;!?.0<{;,0:s;}{.@\>}if}while]0:M;1:i;{,{i*}%:a{M+' '*i 0<{'/'}{"\\"}if +"\n"+}/a)M+:M;;i~):i;}/

Ungolfed version
1/{'/'=}%
1:s;
[{s}
{
  ..(\;!?.0<{;,0:s;}{.@\>}if
}
while]
0:M;
1:i;
{
  ,{i*}%:a{M+' '*i 0<{'/'}{"\\"}if +"\n"+}/
  a)M+:M;;
  i~):i;
}/

At first glance it looked easy... it took me 2.5 hours. Probably there is room for improvement, perhaps tomorrow I'll do some optimization.

JavaScript, 49 48 bytes
Takes input as an array of individual characters and outputs an array of lines.
a=>a.map(c=>" ".repeat(x+=d=c>'/',x-=!d)+c,x=-1)

Saved a byte borrowing a trick from the other JS solution.

Try it

f=
a=>a.map(c=>" ".repeat(x+=d=c>'/',x-=!d)+c,x=-1)
o.innerText=[String.raw`\\\\\\\\\\\\`,String.raw`\\\//\\/\//\\///`,String.raw`\/\/\/`].map(s=>f([...s]).join`\n`).join`\n\n`
oninput=_=>o.innerText=f([...i.value]).join`\n`
<input id=i><pre id=o>

SmileBASIC, 65 bytes
INPUT S$WHILE""<S$C$=SHIFT(S$)DEC N,@L>C$?" "*N;C$INC N,@H<C$WEND

K4, 31 bytes
Solution:
-1(-1+\a-a*~~':a:-1 1"/"=x)$$x:

Examples:
q)k)-1(-1+\a-a*~~':a:-1 1"/"=x)$$x:"\\\\\\//\\\\/\\//\\\\///"
\
 \
  \
  /
 /
 \
  \
  /
  \
  /
 /
 \
  \
  /
 /
/

Works if you start with a / too:
q)k)-1(-1+\a-a*~~':a:-1 1"/"=x)$$x:"/\\\\/\\\\/"
/
\
 \
 /
 \
  \
  /

Explanation:
Generate list of negative numbers to (left) pad each of the input characters. Struggled to get a formula that worked, will look at the other solutions to see if there is a more simple method:
q)k)"/"=x
0001100101100111b
q)k)-1 1"/"=x
-1 -1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1
q)k)~~':a:-1 1"/"=x
1001010111010100b
q)k)a*~~':a:-1 1"/"=x
-1 0 0 1 0 -1 0 1 -1 1 0 -1 0 1 0 0
q)k)a-a*~~':a:-1 1"/"=x
0 -1 -1 0 1 0 -1 0 0 0 1 0 -1 0 1 1
q)k)+\a-a*~~':a:-1 1"/"=x
0 -1 -2 -2 -1 -1 -2 -2 -2 -2 -1 -1 -2 -2 -1 0
q)k)-1+\a-a*~~':a:-1 1"/"=x
-1 -2 -3 -3 -2 -2 -3 -3 -3 -3 -2 -2 -3 -3 -2 -1

Full breakdown:
-1(-1+\a-a*~~':a:-1 1"/"=x)$$x: / the solution
                             x: / save input as variable x
                            $   / string (converts to char lists))
                           $    / pad
  (                       )     / do this together
                     "/"=x      / boolean list of x equal to /
                 -1 1           / index into this list
               a:               / save as variable a
           ~~':                 / differ (not-not-each-previous)
         a*                     / multiply by a
       a-                       / subtract from a
     +\                         / sums
   -1                           / (start summing from -1)
-1                              / print to stdout

Japt -R, 13 bytes
¬®ùZ>'/?°V:V´

Try it online!
Unpacked & How it works
Uq mZ{ZùZ>'/?++V:V--

Input: U = string of / and \, V = 0 (default)

Uq                    Split into chars
   mZ{                Map...
        Z>'/?           If the char is rightward (backslash)...
             ++V          Pre-increment V
                :V--      Otherwise, post-decrement V
      Zù                Left-pad the char with spaces to length V

-R                    Join with newline before printing

Pip, 28 bytes
FlaIlQ'\PsX++v.lE{PsXv.l--v}

With a post decrement operator, this could be way shorter.
Try it online!

Ruby, 47 42 bytes
-5 bytes thanks to Steffan
Inspired by pxeger's Zsh answer.
->a{w=0
a.map{" "*(_1<?@?w-=1:~-w+=1)+_1}}

Attempt This Online!

42

Thunno 2, 11 bytes
JCPDḌ€ḷṡ+ðṙ

Attempt This Online!
Explanation
JCPDḌ€ḷṡ+ðṙ  # Implicit input
JC           # Charcodes of input
  PD         # Are prime, duplicate
    Ḍ€ḷ      # Double, complement
       ṡ+    # Add to cumsums
         ðṙ  # Right-justify
             # Implicit output


text:
Smallest Narcissistic Number
Given a natural numbers n>1, find the smallest narcissistic number of n digit.
A narcissistic number is a number which is the sum of its own digits, each raised to the power of the number of digits.
For example, for n=3 (3 digits) the out put should be 153:
1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153
For n=4 (4 digits) the out put should be 1634:
1^4 + 6^4 + 3^4 + 4^4 = 1 + 1296 + 81 + 256 = 1634
For n=5 (5 digits) the out put should be 54748:
5^5 + 4^5 + 7^5 + 4^5 + 8^5 = 54748
If there is no such numbers, like for example n = 2 or n = 22 output any special output (a negative number, an exception, an error, empty,...).
Winning Criteria
This is code-golf, so shortest answer in bytes by language wins.
OEIS A005188

What if there is no such numbers, like for n = 2

We've tested whether a number is narcissistic, and then I've asked you guys to output all narcissistic numbers (because there are only 88 of them).

@GrzegorzPuławski question updated

@mdahmoune: Would looping indefinitely be acceptable when there is no number?

@Emigna No, any output but not infinite loop.

Is empty output acceptable in that case?

@Emigna yes of course.

It seems like 0 is a narcissistic number according to your definition. But the OEIS sequence starts at 1. So what should we do?

Is hardcoding allowed?

@ThePirateBay yes hardcoding is allowed

@Arnauld consider that n>1, and output any thing for  n==1

This is just a loop round an earlier question, and as such qualifies as a duplicate.

05AB1E, 16 15 bytes
Very inefficient.
Empty output if there is no solution.
°LʒDSImOQ}ʒgQ}н

Try it online!

JavaScript (ES7), 82 79 bytes
Saved 3 bytes thanks to @ThePirateBay
Returns undefined when there's no solution. Reasonably fast up to n = 7 and really slow beyond that.
n=>[...Array(10**n).keys()].find(x=>x==eval([...x+='0'].join(`**${n}+`))&&x[n])

Demo

let f =

n=>[...Array(10**n).keys()].find(x=>x==eval([...x+='0'].join(`**${n}+`))&&x[n])

for(n = 2; n < 6; n++) {
  console.log(n, f(n))
}

Recursive version, 72 bytes
Returns "0" (as a string) when there's no solution. For n > 4, it would require to either enable Tail-Call-Optimization (not tested) or extend the maximum size of the call stack.
f=(n,x=1)=>eval([...s=x+'0'].join(`**${n}+`))-x|!s[n]?s[n+1]||f(n,x+1):x

f=(n,x=1)=>eval([...s=x+'0'].join(`**${n}+`))-x|!s[n]?s[n+1]||f(n,x+1):x

for(n = 2; n < 5; n++) {
  console.log(n, f(n))
}

Pyth, 20 bytes
hfqTsm^dQjT10r^TtQ^T

Try it online!
How it works...
hfqTsm^dQjT10r^TtQ^T    Implicit: Q=input()

                  ^T    10^Q (final Q is inferred)
              ^TtQ      10^(Q-1)
             r          Range over the above
                           (generates list of numbers of length Q)
 f                      Filter each element in the above (as T) over...
         jT10              Get digits in T
     m                     Map each digit in the above (as d) over...
      ^dQ                     d^Q
    s                      Sum these
  qT                       Is the above equal to the original number?
h                       Take the first element of this filtered list

Throws an error if no solutions exist.

16 bytes: f&qQl`Tqsm^dQjT;

Abusing String-ification: f&qQl\Tqsm^sdQ`` (15 bytes)