text:
A scene of Jimmy diversity
As you probably know, there have been multiple lovely Jimmy challenges recently popping up. In these challenges, you were challenged with our beloved friend's acrobatics skills. Now we've got a different challenge for you. Today you will be identifying different types of Jimmys!

Explanation
There are three varieties of Jimmys: dwarf, acrobat, and bodybuilder.
This is dwarf Jimmy:               o

This is acrobat Jimmy:            /o\

This is bodybuilder Jimmy:       /-o-\

These Jimmys are all great friends and they like to stand on the same line as each other. Your task is, given a Jimmy scene like so:
  o  /o\       o   /-o-\/-o-\  o          /o\

Output the amount of dwarves, acrobats, and bodybuilders on the line, respectively.
The challenge

Take input in any reasonable form as a Jimmy scene, as shown in an example above.

The input string should be one line and optionally contains the three varieties of Jimmys and optional whitespace.

The string will not necessarily contain all of the Jimmy varieties or whitespace.

The string will not contain any characters not in o/\ - .

Any combination of Jimmy varieties is possible. This means that the same or different type of Jimmy can be next to each other. You must account for that.

Leading and trailing whitespace is optional and by no means required - your program should account for a string with or without leading and/or trailing whitespace.

The string should contain only valid Jimmys and whitespace. For instance, ---///--- is not allowed because it is not a valid Jimmy sequence.

Output three numbers: The count of dwarves, acrobats, and bodybuilders in the scene (in respective order).

This may be an output to the console as space-separated integers, or it may be a return value from a function as some sort of container (i.e an array type).

The output, in whatever format, must be ordered as mentioned in the top bullet above this rule.

Standard rules and loopholes apply.

Test cases
     /-o-\           /-o-\     o/o\  /-o-\       /-o-\                /-o-\
OUTPUT: 1 1 5

      o o               /o\    o o      o                    /o\             /o\
OUTPUT: 5 3 0

 /-o-\     /-o-\            /-o-\/-o-\   o /o\/o\    /-o-\o /-o-\       /o\/-o-\
OUTPUT: 2 3 7

  /-o-\  o                 /-o-\               o/o\
OUTPUT: 2 1 2

If you'd like more test cases, use this tool to generate more random test cases.
Scoring
This is code-golf, so lowest score in bytes wins.

Can we assume all inputs will have at least one leading and trailing space?

@Shaggy No. Inputs only have optional trailing or leading spaces.

Output three numbers: The count of dwarves, acrobats, and bodybuilders in the scene (in respective order). - is this order a requirement?!

@JonathanAllan Yes, how else would we distinguish the three numbers? I was trying to save you all bytes - using some sort of mapping like {'dwarves': 2, 'acrobats': 5, 'bodybuilders': 0} would cost a terrible amount of bytes. 2 5 0 is much simpler.

Usually the answerer would just state their output format. This keeps I/O flexible. FWIW it'll cost me a byte.

@JonathanAllan I mean, you could return an ordered array too, as I said in the challenge section.

So the output order is not strict then?

@JonathanAllan No, it still is, because otherwise you could never tell which number corresponds to which count. Perhaps I should make that more clear in the post.

@connectyourcharger a more standard way would be to require answers to specify the order.

Note how there is already an answer assuming we can.

Just to be explicit, can Dwarf Jimmys stand together? I see nothing suggesting otherwise.  If so, a test case of oo /o\ o o would be nice

Are newlines valid separators in the output?

@Veskah:  The test case generator is capable of generating the sequence oo.

I'm tempted to build an ANTLR/C# solution, but it wouldn't be a good golf :D

There needs to be a [tag:jimmy] tag.

@MilkyWay90 I can't create it, but I'm all for it.

Jelly, (12?) 13 bytes
ċⱮ“-/o”H1¦ŻIṚ

A monadic Link accepting a list of characters which yields a list of integers, [ dwarves, acrobats, and body-builders] (save the Ṛ byte if we may specify our output)
Try it online!
How?
All Jimmys show a o; all non-dwarves show a /; all body-builders show two -. Count these up, halve the count of -, and perform subtraction to find the Jimmy counts:
ċⱮ“-/o”H1¦ŻIṚ - Link: list of characters
  “-/o”       - list of characters ['-', '/', 'o']
 Ɱ            - map across right with:
ċ             -   count occurrences   = [n('-'), n('/'), n('o')]
         ¦    - sparse application...
        1     - ...to indices: [1] -- i.e. n('-')
       H      - ...action: halve    = [n('-')/2, n('/'), n('o')]
          Ż   - prepend a zero =   [0, n('-')/2, n('/'), n('o')]
           I  - incremental differences
              -     = [n('-')/2, n('/')-n('-')/2, n('o')-n('/')]
            Ṛ - reverse
              -     = [n('o')-n('/'), n('/')-n('-')/2, n('-')/2]

Python 3.8 (pre-release), 51 bytes
lambda s:((c:=s.count)('o')-c('/'),c('/o'),c('/-'))

Try it online!

FINALLY python added something like this. I've been waiting for a while for Python to allow assignments as expressions. A shame it takes an extra byte, but I'll take it :P

@HyperNeutrino That's basically the one reason that you might now see "Python 3.8 (pre-release)" floating around the site. Another restriction is that, unless it's on its own and not the only expression in a statement (in which case you might prefer regular assignment instead), it must be parenthesized (+2 bytes).

How is the first count on the ('o') getting called without a c ?

@Quinn The assignment expression assigns s.count to c and then returns it.

@ErikTheOutgolfer cool, TIL

Python 2, 50 bytes
x,y,z=map(input().count,'o/-')
print x-y,y-z/2,z/2

Try it online!
-10 bytes by converting lambda expression to a full program thanks to @xnor (removes the double-lambda nested thing and uses assignment instead)

This is a nice method, and it's shorter as a program.

PowerShell, 59 55 bytes
$c=,0*3
$args|sls '/?-?o'-a|% m*|% le*|%{++$c[$_-1]}
$c

Try it online!
Unrolled:
$counters=,0*3
$args|select-string '/?-?o'-AllMatches|% Matches|% Length|%{++$counters[$_-1]}
$counters

J, 36 25 bytes
-11 bytes thanks to cole!
2-/\0,~1 1 2%~1#.'o/-'=/]

Try it online!
Original solution
J, 36 bytes
[:(-/@}:,-/@}.,{:)1 1 2%~1#.'o/-'=/]

Try it online!
Explanation:
                            'o/-'=/] compare the input with each one of "o/-" characters
                                     / the result is a 3-row matrix /
                         1#.         add up each row to find the number of occurences
                                     of each character, the result is a vector of 3 items
                  1 1 2%~            divide the last item by 2 to find the number of
                                     bodybuilder Jimmys
[:(              )                   use the result to construct the following vector:
               {:                    the last item
              ,                      appended to
         -/@}.                       the difference of the second and the third items
        ,                            appended to
   -/@}:                             the difference of the first and the second items

A sample J session:
a=:'  /-o-\  o                 /-o-\               o/o\'
   'o/-'=/a
0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
   1#.'o/-'=/a
5 3 4
   1 1 2%~1#.'o/-'=/a
5 3 2
   (-/@}:,-/@}.,{:)1 1 2%~1#.'o/-'=/a
2 1 2

25 bytes?

Whoops, can no longer edit my comment - this is also 25 bytes if it's correct, does a different way of appending the 0.

@cole Hah, as it often occurs to me, I didn't see the pattern. Thank you!

it's unfortunate I only saw it right as you were editing in that explanation - always a shame to lose that much effort of explaining.

@cole That's why I will keep the explanation of my blunder visible :)

Excel as CSV, 130 bytes
,=LEN(A3)-LEN(A4)
=SUBSTITUTE(A1,"-o",""),=(LEN(A2)-LEN(A3))/2
=SUBSTITUTE(A2,"/o",""),=(LEN(A1)-LEN(A2))/2
=SUBSTITUTE(A3,"o","")

Insert input in space before first ,, save as .csv, open in Excel.
Outputs Dwarfs, Acrobats and Bodybuilders in B1, B2 and B3 respectively.

Excel, 244 bytes
=LEN(SUBSTITUTE(SUBSTITUTE(A1,"-o",""),"/o",""))-LEN(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"-o",""),"/o",""),"o",""))&" "&(LEN(SUBSTITUTE(A1,"-o",""))-LEN(SUBSTITUTE(SUBSTITUTE(A1,"-o",""),"/o","")))/2&" "&(LEN(A1)-LEN(SUBSTITUTE(A1,"-o","")))/2

Kotlin 131 130 129 121 117 97 96 88 bytes
fun String.j(b:Int=count{'-'==it}/2,a:Int=count{'/'==it})=listOf(count{'o'==it}-a,a-b,b)

Try it online!
Edit - Wew, got it under 100! I doubt I can shrink it more, but only time will tell...
Edit - Spoke too soon, dropped one more byte by using a list instead of a string
Edit - minus 8 bytes thanks to AsoLeo suggesting using a extension function

Let me tell you about extension methods, my friend: fun String.j(b:Int=count{'-'==it}/2,a:Int=count{'/'==it})=listOf(count{'o'==it}-a,a-b,b) 88 bytes.

@AsoLeo nice, I had actually written it as an extension function originally but I must've messed something else up because mine was more bytes

APL (Dyalog Unicode), 20 bytesSBCS
2-/2÷⍨@2+/'o/-x'∘.=⎕

Try it online!

Retina, 39 35 bytes
Edit: -4 bytes thanks to @FryAmTheEggMan
^((o)|(/o.)|(/-o-.)| )*
$#2 $#3 $#4

Try it online!
Explanation:
A simple replace stage. It finds all matches of the regex ^((o)|(/o.)|(/-o-.)| )* (which should result in one match - the whole string) and replaces it by the number of captures of groups 2, 3, and 4. Here is the regex broken down:
^((o)|(/o.)|(/-o-.)| )*
^                               start at the beginning of the string
 (                       )*     have any amount of Jimmy / spaces
     |       |         |        select one of:
  (o)                           capturing group 2 - dwarf
      (/o.)                   capturing group 3 - acrobat
              (/-o-.)         capturing group 4 - bodybuilder

We have to start with ^ or the end of the input counts as a match too.
In the substitution syntax of Retina, $n references the nth capturing group, and the modifier # counts how many matches it made.

You can save some bytes by escaping less, since the string is guaranteed to be only jimmys: Try it online!

JavaScript, 55 bytes
Searches the string using a regex pattern matching o, o-, or o-\; increments the corresponding count in an array, using the length of each match to determine the index.
s=>s.replace(/o-?\\?/g,m=>a[m.length-1]++,a=[0,0,0])&&a

Try it online!

@JonathanAllan I rewrote my answer.

Python 3, 69 66 60 56 bytes
-4 bytes thanks to @Maarten Fabré
g=input().count
b,c=g('/'),g('/-')
print(g('o')-b,b-c,c)

Try it online!

There is no need for x. You can do g=input().count immediately

R, 63 bytes
Uses Regex matching to find and count the Jimmys.
library(stringr)
str_count(scan(,''),c('(?<![/-])o','/o','/-'))

Try it online!

K (oK), 25 bytes
{|-':|1 1 .5*+/x=\:"o/-"}

Try it online!

Wolfram Language (Mathematica), 63 bytes
Reverse@{a=(m=CharacterCounts@#)["-"]/2,b=m["/"]-a,m["o"]-a-b}&

Try it online!
55 bytes if the pointless order requirement is dropped...

@Xcali should now count dwarves at far left again

Clojure, 78 bytes
(defn ?[s](def c #(count(re-seq % s)))[(-(c #"o")(c #"/"))(c #"/o")(c #"/-")])

Try it online!

Ruby, 50 bytes
->s{%w(o /o -o).map{|x|s.scan(/[\/-]?o/).count x}}

Try it online!

Perl 5 -p, 41 bytes
$_=1*s/o(?!\\|-)//g.$".1*s|/o||g.$".y/o//

Try it online!
Counts the number of times o appears without being followed by \ or - to find the dwarves and removes them from the string.  Then counts the number of times /o appears to find the acrobats and removes them from the string.  Then counts the number of o remaining to determine the body builders.  Inserts spaces between the numbers and implicitly outputs the result.

-1 byte

@NahuelFouilleul  That doesn't work if there's a dwarf at the end of a line.  It counts it as a body builder.

true, otherwise -4 bytes simply removing 1*

@NahuelFouilleul That doesn't work, either.  If there are no examples of those types, it outputs nothing (undef) instead of 0.

ok, i just looked at the test cases

SNOBOL4 (CSNOBOL4), 135 bytes
	I =INPUT
B	I '-o' =	:F(A)
	B =B + 1	:(B)
A	I '/o' =	:F(D)
	A =A + 1	:(A)
D	I 'o' =	:F(O)
	D =D + 1	:(D)
O	OUTPUT =+D ' ' +A ' ' +B
END

Try it online!
Removes -o, /o, and o from the string and increments the appropriate counters each time. Leaves behind a lot of arms and legs (/-\, \, and nothing).

Forth (gforth), 118 bytes
: c -rot 0 tuck do over i + c@ 3 pick = - loop nip nip ;
: f 2dup '/ c >r 2dup '- c 2/ -rot 'o c i - . r> over - . . ;

Try it online!
Explanation

Get Count of /, -, and o characters
Bodybuilder is number of - characters divided by 2
Acrobat is number of / characters minus the number of body builders
Dwarf is number of o characters minus the number of Acrobat and Bodybuilders

Code Explanation
\ c counts the number of occurrences of the given character in a string
\ stack usage is ( c-addr u1 w1 - u )
: c                 \ start a new word definition
  -rot 0 tuck       \ sets up parameters for a counted loop
  do                \ loop from 0 to string-length - 1 (inclusive)
    over i +        \ get the address of the current character in the string
    c@              \ get the ascii value of the current character
    3 pick =        \ compare it to the character we're counting
    -               \ subtract result from the accumulator (subtract because -1 = true in forth)
  loop              \ end the loop
  nip nip           \ remove extra values from the stack
;                   \ end the word definition

\ Main function
: f                 \ start a new word definition
  2dup              \ duplicate the string address and length
  '/ c >r           \ count the number of '/' characters and stick the result on the return stack
  2dup '- c 2/      \ count the number of '-' characters and divide by 2
  -rot 'o c         \ move the string to the top of the stack and count the number of 'o characters
  i - .             \ calculate number of dwarf jimmy's and print
  r> over - .       \ calculate number of acrobat jimmy's and print (drop '/' count from return stack)
  .                 \ print number of body-builder jimmy's
;                   \ end word definition

05AB1E, 13 bytes
…-/oS¢ć;š0š¥R

This one could be 12 bytes by removing the R if an output-order of [bodybuilder, acrobat, dwarf] would have been allowed.
Try it online or verify all test cases.
Minor equal-bytes alternative:
…-/oS¢R`;0)üα

Try it online or verify all test cases.
Explanation:
…-/o           # Push string "-/o"
    S          # Split to a list of characters: ["-","/","o"]
     ¢         # Count the occurrence of each character in the (implicit) input-string
      ć        # Extract the head; pop and push head and remainder-list
       ;       # Halve this head
        š      # And prepend it back in front of the remainder-list
         0š    # Then also prepend a 0
           ¥   # Get the deltas (forward differences)
            R  # And reverse the list to get the required order of output-counts
               # (after which the result is output implicitly)

…-/oS¢         # Same as above
      R        # Reverse this list
       `       # Pop the list and push its values separately to the stack
        ;      # Halve the top value on the stack
         0     # Push a 0
          )    # Wrap all values on the stack into a list
           ü   # For each overlapping pair of values:
            α  #  Get the absolute difference between the two values
               # (after which the result is output implicitly)

C (gcc), 99 98 96 bytes
-1 byte thanks to ceilingcat
o,S,d,c;f(char*s){for(o=S=d=0;c=*s++;o+=c>93)d+=c==45,S+=c==47;printf("%d %d %d",o-S,S-d,d/=2);}

Try it online!

Vyxal, 17 bytes
`-/o`f$vOḣ$½p0pṘ¯

Try it Online!

Ly, 87 bytes
0>0>0>i['-=[pl'o=[p<1+>0]pp0]p'/=[p<<1+>>0]p'o=[p<<<1+>>>0]psp]<s<l-:l+sp<l-u>' ou>' ou

Try it online!
I think this could be shorter, but I've hit a brick wall at this point.
At a high level, it counts the number of - (matched), / and o characters, then subtracts to remove duplicate counts before printing the results.
First is initializes counters to 0 on three different stacks.
0>0>0>

Then it reads the input onto the stack a codepoints, and loops over each character.  The code also saved the current character to the backup cell with s so we can only count matched - characters.
i[ ...                                                sp]

The first check increments the counter on the first stack if it's - and the previous character was o.  That works since the characters are processes in reverse order.
  '-=[pl'o=[p<1+>0]pp0]p

The second check increments the counter on the second stack anytime the code hits a / character.
                        '/=[p<<1+>>0]p

And the last check increments the counter on the third stack when the code finds a o character.
                                      'o=[p<<<1+>>>0]p

Once all the input has been scanned and counted, to code subtracts the number of matched - characters (bodybuilders) from the number of / characters to find the number of acrobats.
<s<l-

Then it remember the number of acrobats plus the number of bodybuilders by stashing the sum of the two in the backup cell.
     :l+sp

Then is subtracts that from the number of o characters to get the final counter and prints it.
          <l-u

The last bits just shift to the next counter and prints with a space appended.
>' ou
And does the same shift/print to output the last counter.
                   >' ou


text:
MQTT subscription topic match
Background
MQTT (Message Queuing Telemetry Transport) is an ISO standard publish-subscribe-based messaging protocol (Wikipedia).
Each message has a topic, such as the following examples:

myhome/groundfloor/livingroom/temperature
USA/California/San Francisco/Silicon Valley
5ff4a2ce-e485-40f4-826c-b1a5d81be9b6/status
Germany/Bavaria/car/2382340923453/latitude

MQTT clients may subscribe to message topics using wildcards:

Single level: +
All levels onward: #

For example, the subscription myhome/groundfloor/+/temperature would produce these results (non-conformances in bold):
✅ myhome/groundfloor/livingroom/temperature
✅ myhome/groundfloor/kitchen/temperature
❌ myhome/groundfloor/livingroom/brightness
❌ myhome/firstfloor/livingroom/temperature
❌ garage/groundfloor/fridge/temperature
Whereas the subscription +/groundfloor/# would produce these results:
✅ myhome/groundfloor/livingroom/temperature
✅ myhome/groundfloor/kitchen/brightness
✅ garage/groundfloor/fridge/temperature/more/specific/fields
❌ myhome/firstfloor/livingroom/temperature
❌ myhome/basement/corner/temperature
More info here.
The Task
Implement a function/program accepting two strings and returning a boolean. The first string is the subject topic, the second is the criteria topic. The criteria topic uses the subscription syntax detailed above. The function is truthy when the subject matches the criteria.
Rules for this task:

Topics are ASCII
There are no criteria fields beyond the # wildcard
Wildcards do not appear in subject topics
Number of subject fields >= number of criteria fields
There are no 0-character fields nor leading or tailing forward slashes

Test cases
criteria1 = "myhome/groundfloor/+/temperature"
criteria2 = "+/groundfloor/#"
("abc", "ab") => false
("abc", "abc") => true
("abc/de", "abc") => false
("myhome/groundfloor/livingroom/temperature", criteria1) => true
("myhome/groundfloor/kitchen/temperature", criteria1) => true
("myhome/groundfloor/livingroom/brightness", criteria1) => false
("myhome/firstfloor/livingroom/temperature", criteria1) => false
("garage/groundfloor/fridge/temperature", criteria1) => false
("myhome/groundfloor/livingroom/temperature", criteria2) => true
("myhome/groundfloor/kitchen/brightness", criteria2) => true
("garage/groundfloor/fridge/temperature/more/specific/fields", criteria2) => true
("myhome/firstfloor/livingroom/temperature", criteria2) => false
("myhome/basement/corner/temperature", criteria2) => false
("music/kei$ha/latest", "+/kei$ha/+") => true

@HyperNeutrino, that's a good question. I'm on the fence. Subject a/b/c would not match criteria a/b, so I'm inclined to say No.

Are /, + and # guaranteed never to appear in topic parts?

I see in the blog linked that "Additionally, the forward slash alone is a valid topic" but no mention of + and #, so I guess these two can be.

@JonathanAllan From http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718106 : The wildcard characters can be used in Topic Filters, but MUST NOT be used within a Topic Name

@NickKennedy - nice digging, but we really shouldn't need to.

Can I return not boolean, but result which have unambiguous cast to it and can be used in binary evaluation?

Also, important note from linked blog: # can be only last character and must preceded by /.

@Patrick: Can you add the following test cases (subject, criteria, output): (music/kei$ha/latest, +/kei$ha/+, truthy); (abc,ab, falsey), (abc/de, abc, falsey).

Don't forget the rule that subscriptions to # should not match topics that start with $sys/ (topics that show internal state of the broker) or $shared/ (topics used for shared subscription groups)

Hi, @hardillb, I had specifically excluded this rule, and adding it now would cause a lot of rewrites of answers.

Python 3, 72 bytes
lambda a,b:bool(re.match(b.translate({43:"[^/]+",35:".+"}),a))
import re

Try it online!
This problem can be trivially simplified to a regex match, though another more interesting method may produce better results.
EDIT I came up with a 107-byte solution not using regex. I don't know if it can get shorter than 72 or maybe I'm just not seeing to correct approach to this. Just the split-zip structure seems to be too large though. Try It Online!

If the sequence contains any other regex characters, this might fail. I'd look out for that even though none of the current test cases contain anything remotely regex-like.

...like f('myhome/ground$floor/livingroom/temperature', 'myhome/ground$floor/+/temperature') which fails

As Value Ink says, +/kei$ha/+ does not match music/kei$ha/latest.

Jelly, 20 bytes
ṣ€”/ZṖF”#eƊ¿œiÐḟ”+ZE

A monadic Link accepting a list of lists of characters, [topic, pattern], which returns 1 or 0 for match or no-match respectively.
Try it online! Or see a test-suite.
How?
ṣ€”/ZṖF”#eƊ¿œiÐḟ”+ZE - Link: list of lists of characters, [topic, pattern]
 €                   - for each:
ṣ                    -   split at occurrences of:
  ”/                 -     '/' character
    Z                - transpose (any excess of topic is kept)
           ¿         - while...
          Ɗ          - ...condition: last three links as a monad:
       ”#            -   '#' character
         e           -   exists in:
      F              -     flatten
     Ṗ               - ...do: pop the tail off
              Ðḟ     - filter discard those for which:
            œi       -   first multi-dimensional index of: ([] if not found, which is falsey)
                ”+   -     '+' character
                  Z  - transpose
                   E - all equal?

Ruby, 65 bytes
Regex solution. I added Regex.escape in case a criteria name just so happens to be something like com.java/string[]/\n or something silly that would have regex pieces.
->s,c{s=~/^#{Regexp.escape(c).sub('\#','.*').gsub'\+','[^/]*'}$/}

Try it online!
Non-regex solution, 77 bytes
Uses a nice simple split, zip, and match technique. I developed this one first before realizing that even with Regex.escape the regex solution would've been shorter anyways.
->s,c{s.split(?/).zip(c.split ?/).all?{|i,j|i==j||'+#'[j||9]||!j&&c[-1]==?#}}

Try it online!

.*? should work in place of [^/]*.

@NicHartley that will trigger a false match for criteria a/+/d with topic a/b/c/d

Ah, so it will. Wrapping that in an atomic group fixes that, but then it's two bytes longer. Oh well.

Perl 5 -pl, 50 bytes
$_="\Q$_";s|\\\+|[^/]+|g;s/\\\#/.*/;$_=<>=~m|^$_$|

Try it online!

small improvement, <>=~/^$_$/ at the end

Clojure, 107 91 76 65 102 bytes
An anonymous function, returns subject topic as truthy and nil as falsey (valid in Clojure).
(defn ?[t c](every? #(#{"#""+"(% 0)}(% 1))(apply #(map vector % %2)(map #(re-seq #"[^/]+" %) [t c]))))

107 102 working
91 76 65 all defeated with regex chars

...and my comment under your question becomes pertinent

@JonathanAllan, indeed, except + and # do not appear in subject topic strings :)

I think this fails for subject music/kei$ha/latest and criteria +/kei$ha/+ (which should match and is valid ASCII).

@ChasBrown, correct, and with ^ instead of $; thanks.

Try with '\Q' before and '\E' after the pattern prior to the replace - source

Python 3, 99 88 bytes
Without using a regex.
With some help from Jonathan Allan and Chas Brown.
f=lambda s,p:p in(s,'#')or p[:1]in(s[:1],'+')and f(s[1:],p['+'!=p[:1]or(s[:1]in'/')*2:])

f=lambda s,p:s==p or'#'==p[0]or p[0]in(s[0]+'+')and f(s[1:],p['+'!=p[0]or(s[0]=='/')*2:]) saves 12. However this fails to process some edge cases like f('abc/ijk/x', 'abc/+/xyz') or f('abc/ijk/xyz', 'abc/+/x'), which can be fixed with f=lambda s,p:s==p or'#'==p[:1]or p[:1]in(s[:1]+'+')and f(s[1:],p['+'!=p[:1]or(s[:1]=='/')*2:])

This fails for f('abc','ab') and f('abc/de','abc') (both should return False, but instead there's an IndexError).

...or p[:1]in(s[:1],'+')and... fixes the edge cases @ChasBrown and I pointed out for a cost of 2 bytes.

Fails another edge case of a trailing '+' (e.g. f('a/b', 'a/+')) but fixable in 0 bytes with ...or(s[:1]in'/')*2:]).

Try it online is always recommended!

Python 2, 85 84 80 92 89 bytes
lambda s,c:all(x in('+','#',y)for x,y in zip(c.split('/')+[0]*-c.find('#'),s.split('/')))

Try it online!
Thanks to Jonathan Allan and Value Ink for pointing out bugs.

Gives the wrong answer on f('ab', 'abc').

@Jonathan Allan: Actually, rules say 'Number of subject fields >= number of criteria fields'. But other problems needed fixing...

Oh weird rule given the problem context!

Haskell, 76 73 71 67 bytes
(a:b)#(c:d)=a=='+'&&b#snd(span(/='/')d)||a=='#'||a==c&&b#d
a#b=a==b

Try it online!
Edit: -4 bytes thanks to @cole.

a#b=a==b seems to work for a few bytes fewer, unless I’m missing something

@cole: yes, that works. Thanks a lot!

JavaScript, 69 66 bytes
t=>s=>new RegExp(s.split`+`.join`[^/]+`.split`#`.join`.+`).test(t)

Try it online!

This fails for subject music/kei$ha/latest and criteria +/kei$ha/+ (which should match and is valid ASCII).

Python 3, 149 148 bytes
def f(t,c):t,c=t.split('/'),c.split('/');return all([c[i]=='+'or c[i]==t[i]or c[i]=='#'for i in range(len(c))])and not(len(c)!=len(t)and c[-1]!='#')

Try it online!

Kotlin, 106 bytes
fun f(s:List<String>)=s[1].split("/").filterIndexed{i,v->v!="+"&&v!="#"&&v!=s[0].split("/")[i]}.count()==0

Try it online!

Jelly, 22 19 bytes
ḟ”+ṣ”/)ZẠƇṖœi”#$¿ZE

Try it online!
A monadic link that takes as its argument [topic], [criterion] and returns 1 for a match and 0 for no match.

Charcoal, 36 bytes
≔⪪Ｓ/θ≔⪪Ｓ/ηＦ∧№η#⊟η≔…θＬηθＦ⌕Ａη+§≔θι+⁼θη

Try it online! Link is to verbose version of code. Outputs - (Charcoal's implicit output for true) for a match, nothing for no match. Explanation:
≔⪪Ｓ/θ

Split the subject on /s.
≔⪪Ｓ/η

Split the criteria on /s.
Ｆ∧№η#⊟η≔…θＬηθ

If the criteria contains (i.e. ends with) a # then remove it and trim the subject to the new length of the criteria.
Ｆ⌕Ａη+§≔θι+

Where the criteria contains + then replace that element in the subject with +.
⁼θη

Compare the subject with the criteria and implicitly print the result.

Retina 0.8.2, 42 bytes
%`$
/
+`^([^/]+/)(.*¶)(\1|\+/)
$2
^¶$|¶#/$

Try it online! Explanation:
%`$
/

Suffix a / to both lines.
+`^([^/]+/)(.*¶)(\1|\+/)
$2

Repeatedly remove the first element of both subject and criteria while they equal or the criteria element is a (happy) +.
^¶$|¶#/$

The criteria matches if it's just a # (with the / that was added earlier) otherwise both subject and criteria should be empty by this point.

Pyth, 22 bytes
:Q::E"[+]""[^/]+"\#".*

Try it online!

05AB1E, 21 bytes
ε'/¡}ζʒ'+å≠}˜'#¡н2ôøË

Input as a list in the order [criteria, topic].
Try it online or verify all test cases.
Explanation:
ε                      # Map both strings in the implicit input-list to:
 '/¡                  '#  Split the string on "/"
                       #   i.e. ["+/+/A/B/#","z/y/A/B/x/w/v/u"]
                       #    → [["+","+","A","B","#"],["z","y","A","B","x","w","v","u"]]
    }ζ                 # After the map: zip/transpose the two string-lists,
                       # with space as (default) filler
                       #  → [["+","z"],["+","y"],["A","A"],["B","B"],["#","x"],[" ","w"],
                       #     [" ","v"],[" ","u"]]
      ʒ    }           # Filter each pair by:
       '+å≠           '#  Only keep those which do NOT contain a "+"
                       #   → [["A","A"],["B","B"],["#","x"],[" ","w"],[" ","v"],[" ","u"]]
            ˜          # Flatten the filtered list
                       #  → ["A","A","B","B","#","x"," ","w"," ","v"," ","u"]
             '#¡      '# Split the list by "#"
                       #  → [["A","A","B","B"],["x"," ","w"," ","v"," ","u"]]
                н      # Only keep the first part
                       #  → ["A","A","B","B"]
                 2ô    # Split this back into pairs of two
                       #  → [["A","A"],["B","B"]]
                   ø   # Zip/transpose them back
                       #  → [["A","B"],["A","B"]]
                    Ë  # And check if both inner lists are equal
                       #  → 1 (truthy)
                       # (after which the result is output implicitly)

source: Stack Exchange

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

sort: votes


text:
Alphanumeric Line and Curve Counting
Given an input string, write a program that outputs the total number of lines and curves it has.
The Challenge

Take input from STDIN, or any other input method.
Output to STDOUT, or any other output method, the total number of lines and curves contained in the string, in that order, based on the below table in the code snippet.
Any non-alphanumeric characters should be ignored.
Standard loopholes are forbidden.
This is code-golf, so shortest code wins.

Clarifications

The lines and curves are determined by the font used on Stackexchange for code blocks.
Circles (like O, o, 0) and dots (i, j), are considered to be 1 curve each.
Input can be a string, list of characters, stream of characters, bytecodes etc.
Output can be an array of integers, tuple of integers, comma-separated string, etc. The two numbers must be separate, so 104 is not valid, but 10,4, 10        4, 10\n4, [10,4], (10, 4), and so on is.
Heading and trailing whitespace is perfectly acceptable.

Sample Input and Output
# Format: str -> line, curve
hi -> 4, 2
HELLO WORLD -> 20, 4
l33+ 5pEak -> 13, 8
+=-_!...?~`g@#$%^ -> 1, 2
9001 -> 5, 3
O o O o O o -> 0, 6

Character Table
Char | Lines | Curves
0    | 1     | 1
1    | 3     | 0
2    | 1     | 1
3    | 0     | 2
4    | 3     | 0
5    | 2     | 1
6    | 0     | 1
7    | 2     | 0
8    | 0     | 2
9    | 0     | 1
A    | 3     | 0
B    | 1     | 2
C    | 0     | 1
D    | 1     | 1
E    | 4     | 0
F    | 3     | 0
G    | 2     | 1
H    | 3     | 0
I    | 3     | 0
J    | 1     | 1
K    | 3     | 0
L    | 2     | 0
M    | 4     | 0
N    | 3     | 0
O    | 0     | 1
P    | 1     | 1
Q    | 0     | 2
R    | 2     | 1
S    | 0     | 1
T    | 2     | 0
U    | 0     | 1
V    | 2     | 0
W    | 4     | 0
X    | 4     | 0
Y    | 3     | 0
Z    | 3     | 0
a    | 0     | 2
b    | 1     | 1
c    | 0     | 1
d    | 1     | 1
e    | 1     | 1
f    | 1     | 1
g    | 1     | 2
h    | 1     | 1
i    | 3     | 1
j    | 1     | 2
k    | 3     | 0
l    | 3     | 0
m    | 3     | 2
n    | 2     | 1
o    | 0     | 1
p    | 1     | 1
q    | 1     | 1
r    | 1     | 1
s    | 0     | 1
t    | 1     | 1
u    | 1     | 1
v    | 2     | 0
w    | 4     | 0
x    | 4     | 0
y    | 1     | 1
z    | 3     | 0

@ElPedro I'll go fix that, 2 is supposed to be (1,1)

What counts as a line and curve?  Is s 2 curves or 1? Is the stem in j both a line and curve?  It would be best if you could just list the required values for all of the letters.

@SriotchilismO'Zaic There is a table in the code snippet at the bottom of the post that has "canonical" values for you to use. My non-competing answer is based on that table.

I really don't understand the downvotes on this one. For me this is a well specified challenge with good test cases, a reference implementation and a table of what values are expected (whether they are technicaly right or worng is a matter of personal opinion but nothing to do with the challenge)..Input and output are flexible. If someone can explain what is wrong with this I would be most grateful.

Can you please provide the values for each character in a format that we can more easily copy; the Snippet is entirely unnecessary.

I had it as a Markdown-like table while it was in Meta, if you'd like that.

o should be 0 lines, 1 curve

@Shaggy I was too lazy to reformat the data which is why HermanL beat me hands down on my Python answer. For me the data format works. Just takes a bit of time to format how you need.

Is it allowed to output as a list of long numbers? So it looks like [4L, 2L] instead of [4, 2] ?

@DaniilTutubalin As long as it's clear that they are 2 separate numbers, yes.

@ElPedro Being well specified is expected of a challenge as the bare minimum and does not grant immunity to downvotes.   The downvotes are because people dislike the content of the challenge.  The challenge is just implement this lookup table which has been done to death and IMO was not very interesting in the first place.

@SriotchilismO'Zaic. Thanks for taking the time to reply to my question and for your explanation. I do have to say that I don't entirely agree though. For me, downvotes are for a badly specified question that does not meet the standards that are expected on this site. If OP then improves the question then the downvote can be retracted. If it is a matter of opinion that one doesn't like a question/challenge then move on to the next one. If it has been "done to death" then vtc as a duplicate with examples. What I think is unnecessary is downvotes with no reason being given in the comments.

Continued from above...Downvotes with no feedback give OP little chance to improve their challenges in the future.

Haskell, 214 199 188 175 bytes
 g 0=[]
 g n=mod n 5:g(div n 5)
 d#s=sum[n|c<-d,(i,n)<-zip['0'..]$g s,c==i]
 f s=(s#0x300BBD37F30B5C234DE4A308D077AC8EF7FB328355A6,s#0x2D5E73A8E3D345386593A829D63104FED5552D080CA)

Try it online!
The numbers of lines and curves are the digits of base-5 numbers and stored as base-16 numbers. Function g translates back to base-5.
Edit: -13 bytes thanks to @cole.

169 bytes if you can take a list of charcodes. Going to explore porting this to the string variant…

175 bytes if you have to use strings (deleted my previous comment since i golfed a trivial 3 bytes off).

@cole: thanks for the improvements. Going with a list of integers feels like cheating, because the challenge is tagged as "string". On the other hand, the rules allow "bytecodes" as a valid input format. However, many other answers also use some sort of char -> integer conversion. Don't know what to do.

05AB1E, 78 69 65 bytes
-4 bytes thanks to Kevin Cruijssen, Go and check out his even better 05AB1E answer
žKÃÇ48-©•7ć_qýÊΣŸßαŽ_ì¡vFÛ–ÄÔ™”súyån!₁ζB?òrβÂ@µk₆¼×¬°•5в2ä`®èrè‚O

Try it online!
Outputs as [Curve, Line]
I'm really bad at 05AB1E I just found out. Can definitely save more bytes if I can get 05AB1E to do è across my list of lists

Explanation
žKÃ                                    #Filter out non alpha-nums
    Ç48-                               #Convert to ascii and subtract 48 so "0" is 0 etc.
        ©                              #Store that for later
          •...•5в                      #De-compress compressed list
                 2ä                    #Split into 2 chunks (lines + curves)
                   `                   #Separate them onto the stack
                    ®                  #Get the value that we stored
                     èrè               #Apply indexing to both lists
                        ‚              #Put our indexed values back into a list
                         O             #Sum our lists

Your output is reversed. It should be line curve, not curve line.

Output can be an array of integers, tuple of integers, comma-separated string, etc. The two numbers must be separate @bigyihsuan they are separate, I don't see what the issue is

Rules do say Output to STDOUT, or any other output method, the total number of lines and curves contained in the string, in that order. Note the in that order, so line curve.

I would agree with @ExpiredData on this one. Maybe specify in the challenge that the order should be stated in the answer. That would be enough to get by.

53 bytes (and with [Line, Curve] as output-order, although that is a coincident and not intentional).

Here an explanation for my 53-bytes version above. PS: Using your approach of code-points -48 could have a few bytes saved by using žKÃ (keep alphanumeric characters) instead of SʒžKså}. And by compressing them as pairs and using 2ô, so you'd only need a single è. :)

@ExpiredData Done :) You can still golf your own answer with žKÃ instead of SʒžKså}, though. ;)

Jelly, 45 bytes
ØBċþSḋ“yƘ.ṪñF[)µṡṭɗḌyė$Ṫk“¢⁶KɱzV$QḂḥỵṙu’b5,3¤

A monadic Link accepting a list of characters which yields a list of (two) integers.
Try it online! Or see the test-suite.
How?
ØBċþSḋ“...“...’b5,3¤ - Link: list of characters, T
ØB                   - base-chars = "01...9A...Za...z'
   þ                 - outer product with T using:
  ċ                  -   count occurrences
    S                - sum -> [n(0), n(1), ..., n(9), n(A), ..., n(Z), n(a), ..., n(z)]'
                   ¤ - nilad followed by link(s) as a nilad:
      “...“...’      -   list of two large integers (encoded in base 250)
                5,3  -   five paired with three = [5,3]
               b     -   to base  -> [[Lines(0), Lines(1), ...], Curves(0), Curves(1), ...]
     ḋ               - dot-product

Python 2, 159 154 bytes
For any character lines*4 + curves gives value from 0 to 16. Base-36 is used to encode these values (1 character = 1 value).
-5 bytes thanks to @Chas Brown
lambda s:map(sum,zip(*(divmod(int("5c52c918210000000c615gc9cc5c8gc15291818ggcc00000025155565d6cce915551558gg5c"[ord(x)-48],36),4)for x in s if'/'<x<'{')))

Try it online!
Python 2, 141 bytes
This is a port of my Python3 solution.
This version outputs a list of long ints, so it looks like [4L, 2L] instead of [4, 2].
lambda s:map(sum,zip(*(divmod(int("8BK5NLC8RS10XWUX12BG408C2UELUAFEOVARZKCHEEDDMXG09L48ZG",36)/13**(ord(x)-48)%13,3)for x in s if'/'<x<'{')))

Try it online!

154 bytes using base36 and '/'<x<'{' instead of x.isalnum().

@Chas Brown thanks! I was also thinking about '/'<x<'{', but I tried to put it in expression to get rid of if as well.

Scala, 235 bytes
val a=('0'to'9')++('A'to'Z')++('a'to'z')
def f(s:String)=s.filter(a.contains(_)).map(c=>"gdgkdhfckfdlfgedhddgdcedfgkhfcfceeddkgfggglgilddnhfgggfggceegd"(a.indexOf(c))-'a').map(x=>(x%5,x/5)).foldLeft((0,0))((x,y)=>(x._1+y._1,x._2+y._2))

Try it online!
Not so small, probably can be golfed further.
Note: The 52-character string literal is like a dictionary which maps a character to another character which denotes number of lines and curves according to the following table:
Curves|Lines
      |0 1 2 3 4
----------------
     0|a b c d e
     1|f g h i j
     2|k l m n o

JavaScript (Node.js), 251 219 217 bytes
-34 bytes from @Expired Data :o
_=>_.map(a=>(p+=~~"13103202003101432331324301020202443301011111313332011101124413"[(x=a.charCodeAt()-48)>16?(x-=7)>41?x-=6:x:x])&(o+=~~"10120110210211001001000011211010000021111121120021111111100010"[x]),p=o=0)&&[p,o]

Try it online!

217 bytes actually

Jelly, 51 bytes
ØBiⱮị“Æƭ&¶*ṪḳAøƬsøD<~²ṂvṠỤṣT3rdʠ¬⁻ÇṆṇ.ÑƑaȮż’b5¤s2¤S

Try it online!
A monadic link that takes a string as input and returns a list of integers as [lines, curves]

R, 164 153 bytes
function(s,`!`=utf8ToInt,x=(!"

")[match(!s,c(48:57,65:90,97:122),0)])c(sum(x%%5),sum(x%/%5))

Try it online!
I had the same idea as nimi's answer using a base 5 encoding but encodes as ASCII characters instead of base 16. Uses nomatch = 0 in match to eliminate non-alphanumeric characters.
Returns curves lines.

Retina 0.8.2, 160 bytes
$
¶$`
T`dLl`13103202003101432331324301020202443301011111313332011101124413`^.*
T`dLl`10120110210211001001000011211010000021111121120021111111100010`.*$
.
$*
%`1

Try it online! Link includes test cases. Explanation:
$
¶$`

Duplicate the input string.
T`dLl`13103202003101432331324301020202443301011111313332011101124413`^.*

Count each character's lines on the first line.
T`dLl`10120110210211001001000011211010000021111121120021111111100010`.*$

Count each character's curves on the second line.
.
$*
%`1

Sum the digits separately on each line.

Charcoal, 60 bytes
ＩＥ⟦”)⊞∧cⅉ→ÞＹγμ◧⊞¶u№¶⊘¶∕«⁸””)∨⧴｜υ;↷dLτＩüＯ¦:”⟧Σ⭆Φθ№⭆ι⍘ξφλ§ι⍘λφ

Try it online! Link is to verbose version of code. Explanation:
Ｅ⟦”)⊞∧cⅉ→ÞＹγμ◧⊞¶u№¶⊘¶∕«⁸””)∨⧴｜υ;↷dLτＩüＯ¦:”⟧

This is an array of two strings 13103202000101111131333201110112441331014323313243010202024433 and 10120110212111112112002111111110001002110010010000112110100000. The strings are then mapped over.
Φθ№⭆ι⍘ξφλ

The elements of the input are filtered over whether they are contained within the (62) characters of the default base conversion alphabet.
⭆...§ι⍘λφ

The elements that remain are then converted from base (62) and this is then indexed into the mapped string.
Ｉ...Σ...

The digits are summed and cast back to string for implicit print.

Python 2, 179 166 165 163 bytes
lambda s:[sum(p[:max(0,p.find(c))].count(',')for c in s)for p in',02BDJPbdefghjpqrtuy,57GLRTVnv,14AFHIKNYZiklmz,EMWXwx',',02569CDGJOPRSUbcdefhinopqrstuy,38BQagjm']

Try it online!
Returns a list [curves, lines].

Python 3, 165 159 148 146 bytes
For any character (including non-alphanumeric) lines*3 + curves gives value from 0 to 12, so we can use long base-13 number to encode data. To make it shorter it is converted to base-36.
Thanks to @Chas Brown for great advices.
-2 bytes by converting lambda to program.
print(*map(sum,zip(*(divmod(int("8BK5NLC8RS10XWUX12BG408C2UELUAFEOVARZKCHEEDDMXG09L48ZG",36)//13**(ord(x)-48)%13,3)for x in input()if'/'<x<'{'))))

Try it online!

Python 2, 525 bytes
l=c=0;e=[(1,1),(3,0),(1,2),(0,2),(3,0),(2,1),(0,1),(2,0),(0,2),(0,1),(3,0),(1,2),(0,1),(1,1),(4,0),(3,0),(2,1),(3,0),(3,0),(1,1),(3,0),(2,0),(4,0),(3,0),(0,1),(1,1),(0,2),(2,1),(0,1),(2,0),(0,1),(2,0),(4,0),(4,0),(3,0),(3,0),(0,2),(1,1),(0,1),(1,1),(1,1),(1,1),(1,2),(1,1),(3,1),(1,2),(3,0),(3,0),(3,2),(2,1),(0,1),(1,1),(1,1),(1,1),(0,1),(1,1),(1,1),(2,0),(4,0),(4,0),(1,1),(3,0)]
d='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
for i in input():
 if i in d:
  p=d.find(i);l+=e[p][0];c+=e[p][1];
print l,c

Try it online!
Similar approach to the reference implementation but somewhat shorter.

283 bytes

Thought about that while I was having a much needed beer in the Biergarten after work but it was too much work to reformat on my handy :)

@HermanL Feel free to post as your own answer. I have no time to update this eve.

265 bytes with a bit more golfing...

231 bytes

Perl 5 -MList::Util=sum -p, 180 bytes
say sum y/0-9A-Za-z/13103202003101432331324301020202443301011111313332011101124413/r=~/./g;$_=sum y/0-9A-Za-z/10120110210211001001000011211010000021111121120021111111100010/r=~/./g

Try it online!

05AB1E, 53 bytes
•xþ¢*>ÌŸÑå#÷AUI'@æýXÁи<¥èå–ΘηžÎà₅åÇšÄ•5вR2ôžKISk®KèøO

Try it online or verify all test cases.
Explanation:
•xþ¢*>ÌŸÑå#÷AUI'@æýXÁи<¥èå–ΘηžÎà₅åÇšÄ•
                 '# Compressed integer 101629259357674935528492544214548347273909568347978482331029666966024823518105773925160
 5в               # Converted to base-5 as list: [1,0,2,0,0,2,1,0,1,2,0,3,2,0,1,1,0,3,1,1,0,3,0,3,0,4,0,4,0,2,1,0,0,2,1,0,1,2,2,0,1,1,1,0,0,3,0,4,0,2,0,3,1,1,0,3,0,3,1,2,0,3,0,4,1,1,1,0,2,1,0,3,0,3,1,1,0,4,0,4,0,2,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,2,2,3,0,3,0,3,2,1,1,3,1,1,2,1,1,1,1,1,1,1,1,0,1,1,2,0]
   R              # Reverse this list (due to the leading 0)
    2ô            # Split it into pairs: [[0,2],[1,1],[0,1],[1,1],[1,1],[1,1],[1,2],[1,1],[3,1],[1,2],[3,0],[3,0],[3,2],[2,1],[0,1],[1,1],[1,1],[1,1],[0,1],[1,1],[1,1],[2,0],[4,0],[4,0],[1,1],[3,0],[3,0],[1,2],[0,1],[1,1],[4,0],[3,0],[2,1],[3,0],[3,0],[1,1],[3,0],[2,0],[4,0],[3,0],[0,1],[1,1],[0,2],[2,1],[0,1],[2,0],[0,1],[2,0],[4,0],[4,0],[3,0],[3,0],[1,1],[3,0],[1,1],[0,2],[3,0],[2,1],[0,1],[2,0],[0,2],[0,1]]
      žK          # Push builtin string "abc...xyzABC...XYZ012...789"
        IS        # Push the input, split into characters
          k       # Get the index of each of these characters in the builtin-string
           ®K     # Remove all -1 for non-alphanumeric characters that were present
             è    # Use these indices to index into the earlier created pair-list
              ø   # Zip/transpose; swapping rows/columns
               O  # Sum both inner lists
                  # (after which the result is output implicitly)

See this 05AB1E tip of mine (sections How to compress large integers? and How to compress integer lists?) to understand why •xþ¢*>ÌŸÑå#÷AUI'@æýXÁи<¥èå–ΘηžÎà₅åÇšÄ• is 101629259357674935528492544214548347273909568347978482331029666966024823518105773925160 and •xþ¢*>ÌŸÑå#÷AUI'@æýXÁи<¥èå–ΘηžÎà₅åÇšÄ•5в is [1,0,2,0,0,2,1,0,1,2,0,3,2,0,1,1,0,3,1,1,0,3,0,3,0,4,0,4,0,2,1,0,0,2,1,0,1,2,2,0,1,1,1,0,0,3,0,4,0,2,0,3,1,1,0,3,0,3,1,2,0,3,0,4,1,1,1,0,2,1,0,3,0,3,1,1,0,4,0,4,0,2,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,2,2,3,0,3,0,3,2,1,1,3,1,1,2,1,1,1,1,1,1,1,1,0,1,1,2,0].

Python 3, 697 bytes
def f(s):
    l=0;c=0;d={'0':(1,1),'1':(3,0),'2':(1,2),'3':(0,2),'4':(3,0),'5':(2,1),'6':(0,1),'7':(2,0),'8':(0,2),'9':(0,1),'A':(3,0),'B':(1,2),'C':(0,1),'D':(1,1),'E':(4,0),'F':(3,0),'G':(2,1),'H':(3,0),'J':(1,1),'K':(3,0),'L':(2,0),'M':(4,0),'N':(3,0),'O':(0,1),'P':(1,1),'Q':(0,2),'R':(2,1),'S':(0,1),'T':(2,0),'U':(0,1),'V':(2,0),'W':(4,0),'X':(4,0),'Y':(3,0),'Z':(3,0),'a':(0,2),'b':(1,1),'c':(0,1),'d':(1,1),'e':(1,1),'f':(1,1),'g':(1,2),'h':(1,1),'i':(3,1),'j':(1,2),'k':(3,0),'l':(3,0),'m':(3,2),'n':(2,1),'o':(0,1),'p':(1,1),'q':(1,1),'r':(1,1),'s':(0,1),'t':(1,1),'u':(1,1),'v':(2,0),'w':(4,0),'x':(4,0),'y':(1,1),'z':(3,0)};
    for i in s:
        if i in d:
            l+=d[i][0];c+=d[i][1];
    return l,c

A simple first attempt. I put the table into a dictionary, looped through the string, incremented some counters, and returned a tuple. Input is a string.
Try it online!

Why non competing? Looks fine to me.

Why the downvote without a comment?

C# (Visual C# Interactive Compiler), 157 bytes
x=>(x=x.Where(n=>n<123&n>47)).Sum(n=>p[n-48]/5)+" "+x.Sum(n=>p[n-48]%5);var p=@"

";

Try it online!

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


text:
Brute-force the switchboard
The other day, our team went to an escape room. One of the puzzles involved a board of six mechanical switches where you had to find the correct combination of on and off in order to unlock a box, somewhat like this:
-v-v-v-
-v-v-v-

Being developers, we decided it would be more efficient to try every single one of 2^6=64 combinations than actually solve the puzzle. So we assigned some poor guy to do some binary counting:
-v-v-v-
-v-v-v-

-v-v-v-
-v-v-^-

-v-v-v-
-v-^-v-

-v-v-v-
-v-^-^-

and so on.
The challenge
Write a program that, given the switches all in off position as a string formatted as above, generates all combinations of on and off in any order.
You can write either a full program or a function. Thus, your program can either take in input through stdin, a file, or as a single string argument, and either return or print the output. If returned, the output may be in a list/array/etc. rather than a single string. If the output is a single string, the boards should be separated by newlines (trailing newlines are allowed.)
The input strings will match the regex r'((-v)+-)(\n(-v)+-)*' and represent one board with all switches off. This means no zero case, and switches are left-aligned. Each row might not have the same number of switches.
Each output board should be of the exact same format as the input, except that the v's may be replaced by ^'s as required. The output boards can be separated by any number of newlines.
Since runtime is naturally O(2^n) in the number of switches, your code will not be tested on any more than 10 switches in any arrangement.
This is code-golf, so shortest code in number of bytes wins.
Sample inputs and outputs
Input:
-v-

Possible output:
-v-
-^-

Input:
-v-
-v-

Possible output:
-^-
-^-
-^-
-v-

-v-
-^-

-v-
-v-

Since it's extremely tedious to check your answer for bigger numbers of switches, here's a Python script as a sanity check tool. (I've included a currently commented-out snippet to generate expected output from a given input file in case you want more test cases.) It's quite a bit less flexible in terms of input and output than the spec, unfortunately; put the input string in a file named 'input' and the newline-separated output (sorry, no list formatting) in a file named 'output' in the same directory and run python3 sanitycheck.py.

nice first challenge!

Hopefully, the "poor guy" knew about Gray code in order to only flip one bit between each combination.

Time is our most precious asset, don't waste it in vain.

Given the theme, I'm disappointed you didn't require an order that requires the least amount of toggles (e.g. 00->01->11->10 has 3 toggles while 00->01->10->11 has 4)  -- Fellow brute force escaper

@EricDuminil Lol yeah, we were all a little ignorant, thanks for enlightening me to that though

@ikegami ah, fair, I thought it would be interesting to see the most golfy ways to fit them into each different programming language though rather than just one or two algorithms that everyone uses.
Even so, it looks like bunch of them did turn out to just be binary counting xd

@Giuseppe and five others Thank you so much! I was super pleasantly surprised to wake up to 18 answers :v

@ikegami That's the Gray code I was talking about.

@Eric Duminil, Yeah. I only noticed that your comment was talking about the same thing far afterwards.

@EricDuminil: if the mechanical switches were not buttons (and maybe even if), then most likely, the difference the time needed between switching one, two and three consecutive switches (which you could probably do almost simultaneously) wouldn't be large enough to offset the extra mental work to follow the Gray code.

@tomasz: Maybe. But aren't we all here for the "extra mental work"? When I'm afraid that a programming task is too complex or might take too long, I come back to read this answer.

@EricDuminil: My point is, the extra mental work will give you overhead which might negate any (time) advantage that you would gain from not having to do as many individual switches (especially if you can switch several switches simultaneously). Which is bad if you are pressed for time, as you might be in an escape room. Indeed, the whole premise of this problem is doing brute force instead of doing the mental work and solving the puzzle.

@PedroLobito "Don't waste it in vain" nice pleonasm! :)

@teleporting-goat, time is always "wasted" because you cannot stop it, but you can choose to spend it wisely,  not in vain. It may not make too much sense to french speakers,  which is normal,  since their preception of reality is normally distorted.

@PedroLobito I'll pass on the personal attack on French speakers being 'not normal' and won't add anything else after this bc comments aren't for this, but no. To "waste time" is to spend time in vain, especially in your context. If it's spent cleverly and usefully, it's just spent. Time is wasted when something could be done faster or when you wait for nothing. You could literally have said "time is precious, don't waste it" or "don't spend it in vain" and the meaning would be basically the same. Perhaps it would help to look at definitions.

Haskell, 25 24 23 17 bytes
mapM$min"^v".pure

Try it online!
-1 byte thanks to @H.PWiz
-1 byte thanks to @nimi
Returns a list of strings. The TIO has 2 extra bytes for the function declaration - I've seen other people leave it off when they write the function pointfree so I'm doing the same unless told otherwise.
Previous Answer (25 bytes)
g 'v'="v^"
g x=[x]
mapM g

The explanations are all for the previous answer, which works pretty much the same way, except I inlined the definition of g. The way g works now is by using lexical comparison to substitute ^v for v and keep everything else the same.
Interestingly, this works for arbitrary switchboards:
>>> mapM g "-----^-----"
  ["-----v-----", "-----^-----"]

Explanation (Short)
g 'v'="v^" -- for 'v', choose between 'v' or '^'
g x=[x]    -- for any other character, choose just that character
mapM g     -- find all ways to choose characters using g on the given input

Explanation (Long)
mapM is a pretty scary function for those not familiar with Haskell. But it's not hard to understand in this context. By making it act on Strings (which in Haskell are lists of characters), I've specialized it to its definition for lists. So in this context, its type signature is
mapM :: (a -> [b]) -> [a] -> [[b]]
--      ^^^^^^^^^^                  arg 1: a function from any a to a list of b
--                    ^^^           arg 2: a list of a
--                           ^^^^^ return: a list of list of b

It is actually even more specialized in my usage of it - a and b are both Char - so we can see the type signature as
mapM :: (Char -> String) -> String -> [String]

Let's quickly look at what g does before explaining how mapM works.
g :: Char -> String
g 'v' = "v^"
g  x  = [x]

g uses pattern matching to convert the Char 'v' into the string "v^"; everything else gets converted to a singleton string (remember, strings are just lists of Chars, so we can put x in a singleton list). Testing on the REPL, we find this is the case
>>> g 'a'
  "a"
>>> g 'b'
  "b"
>>> g 'v'
  "v^"

Note that g has the right type to be an argument of mapM (unsurprisingly!).
We'll explore how mapM works by giving it g and the argument
"-v-\n-v-"

as input.
mapM first maps g over the String, and because g converts Chars to Strings, this gives us a list of Strings
["-", "v^", "-", "\n", "-", "v^", "-"]

While this is the correct output type, mapM does slightly more. You can think of it as forming all Strings that you could create from this list if you had to pick a single character from each String in it (in order).
So for the first element, you have no choice other than to pick the Char '-'. For the second element, you can choose between 'v' and '^', so on and so forth.
It's roughly equivalent to this python code:
result = []
for x1 in "-":
  for x2 in "v^":
    for x3 in "-":
      ...
        result.append(''.join([x1, x2, x3, x4, x5, x6, x7]))

Except that since Haskell separates between Chars and Strings, when it puts the Chars into a list, it doesn't need to join them.
So the final output is
["-v-\n-v-", "-v-\n-^", "-^-\n-v-", "-^-\n-^-"]

as desired.

Ooh, I've been waiting for a purely functional answer, this really blew me away at how concise it was.

@Rin'sFouriertransform I was pleased with how nicely mapM worked for this challenge, at first I had it formulated as sequence . map g but that can be expressed compactly as mapM id . map g and then I saw I could just mapM g

I think you can swap =='v' for >'-'

Jelly, 7 bytes
«Ƭ€”^Œp

Try it online!
Output is a list of Jelly strings.
Explanation:
«Ƭ€”^Œp  Arguments: 1
«Ƭ€”^    Dyad-nilad pair
  €       Map over left argument
 Ƭ         Apply repeatedly until a result that has previously been seen is seen
           again, return original and intermediate results
«           Dyad: Minimum of arguments
   ”^     Nilad: Literal: '^'
         Note: 'v' is the only character that is greater than '^' and can
         appear in the input, so, while for every character c other than 'v'
         this operation returns [c], for 'v' it returns ['v', '^']. In this way,
         duplicates are never going to appear in the output.
     Œp  Monad: Cartesian product of elements

I've actually been scrambling through the Jelly code pages to try to figure out how the first answer has continually outgolfed every single other answer, almost always by a pretty good margin...would you care to explain how this works?

@Rin'sFouriertransform I've added an explanation.

Perl 6, 32 bytes
{[X~] .comb».&{$_,('^'if /v/)}}

Try it online!

.comb splits the string into characters.
».&{...} maps the characters according to the function between the braces.
$_, ('^' if /v/) produces a list of alternates for each character.  Only v has an alternate: ^.
[X~] reduces that list with the string-concatenation cross-product operator X~.

Perl 5, 29 bytes
sub{glob"\Q@_"=~s/v/{v,^}/gr}

Try it online!
My first submission!

Normally, Perl 5 golfers submit programs instead of functions to save from having to include sub{} at a minimum. But they have to add say, say␠, say for or say for␠ in exchange.
By going the sub approach, I could shorten
say for glob"\Q$_"=~s/v/{v,^}/gr        # Perl 5, -0n, 32 bytes

to
sub{glob"\Q@_"=~s/v/{v,^}/gr}           # Perl 5, 29 bytes

The explanation is quite simple. Perl 5 has a builtin glob operator which accepts a shell-like glob pattern which can be used to generate lists of file names (e.g. foo*.txt) or list of strings (e.g. {a,b,c}). The catch is that the newline needs to be escaped, which I've done using quotemeta (as \Q).

K (ngn/k), 27 25 bytes
{(?,/,/:\:)/x,'"^"/"v"\x}

Try it online!
"^"/"v"\ replace "v" with "^"
x,' zip with the original chars
(?,/,/:\:)/ uniq cartesian product over

.. and here's me thinking I did alright in 44 bytes!

APL (Dyalog Classic), 21 17 15 bytes
⊃⊢∘.,.∪'v'⎕r'^'

Try it online!
similar to my k solution
returns an n-dimensional array of strings (n = number of switches)
in easier to explain form: ⊃(∘.,⌿ ⊢ ∪¨ 'v'⎕r'^')
'v'⎕r'^' replace vs with ^s
⊢ ∪¨... unions with each of the original characters. it's a vector of strings of length 1 or 2
∘.,⌿ cartesian product reduction
⊃ disclose
to get to the fully golfed version we follow the pattern f⌿ A g¨ B -> A f.g B:
∘.,⌿ ⊢ ∪¨ 'v'⎕r'^' -> ⊢ ∘.,.∪ 'v'⎕r'^'
as a side effect the parentheses are no longer needed

Anything with an outer-product inner product deserves +1.

Java, 202 197 189 191 bytes
Yes, it's a comparatively verbose language, but that's what I consider as classical golfing:
import java.util.function.Function;

public class SwitchBored
{
    public static void main(String[] args)
    {
        Function<String, String> f = s->{byte i,j,k,m=1,u='^',d='v',a[]=(s+"\n\n").getBytes();for(i=0,s="";i<m;i++,s+=new String(a))for(j=0,k=0;k<a.length;k++){if(a[k]==d||a[k]==u){a[k]=(i&1<<j++)!=0?u:d;m<<=i>0?0:1;}}return s;};

        //System.out.println(f.apply("-v-"));
        System.out.println(f.apply("-v-v-v-\n-v-v-v-"));
        //System.out.println(f.apply("-v-v-v-\n-v-v-"));
        //System.out.println(f.apply("-v-v-v-v-v-\n-v-"));
        //System.out.println(f.apply("-v-v-v-v-v-\n-v-v-v-v-v-"));
    }
}

I thought that a "simple" way of dealing with the line breaks that are necessary to achieve to proper layout was to actually re-use the original input character array, and only fill it with 'v's and '^'s at the appropriate positions.
Updates:
It turned out that not storing the positions allows ditching the int and array variable declarations (at the cost of checking each position of the array whether it contains an v or ^ on the fly), saving 5 bytes.
Another 8 bytes saved by computing the upper limit (1<<numberOfSwitches) more compactly.
According to the rule mentioned in the comment, function declaration should be counted, so now it's a lambda...

I'm pretty sure you have to include the function definition (String generate(String s) {...}) in your byte count. Here's a fixed/lambda version for 191 bytes. I did some minor golfing to shave off 3 bytes

@BenjaminUrquhart OK, these are details of the "rules" that I'm not familiar with (I'm not golfing here sooo regularly). I thought that the actual { function body } should be relevant, because it does not matter whether you put it into a function that is static or not, and of course, if the declaration counts towards the score, one can convert it into a lambda expression. But that's what is done now, thanks for pointing this out.

A few suggestions: 1. use ascii-codes, not chars (d=94). 2. Initialise i when you declare it. 3. Use i++<m instead of separate increment (need to modify the contents of the loop in one place, but this adds no cost). 4. Can you get away with (i&1<<j++)>0? 5. I don't think you need the {} for the inner for loop. 6. You can replace a[k]==d||a[k]==u with a[k]>45, I think. 7. Go with j=k=0. All that should remove 19bytes.

@VisualMelon Some of these are the "classical golfing" approaches, and I already applied some of them. Whether or not they are applicable depends - I think that some {} are necessary, but I can have another look. The a[k]>45 may be a neat trick, however. Admittedly, I only wrote this to waste some time waiting for a meeting to start (hence the class name - this was intentional ;-)) but maybe I'll have another look - thanks in any case!

@Marco13 indeed, they are classic tricks, but all applicable here specifically. I won't spoil the fun by giving you my 172 byte solution based on them (BTW, it think yours is 192, not 191, but I don't know how the lambda counting works: I'm opposed to it in any case).

@VisualMelon It's a "contest", in the end - so don't hesitate to post your solution! The 191 came from the comment by Benjamin, and I also wondered whether the final ; should be counted. But let's start nitpicking when we're comparing your 172 solution to a potential 171 one ;-)

Last couple of hints (I should be asleep...) 8. Changing to s+="\n\n" and removing s="" gives you one of the outputs straight away: you just have to find a way to terminate the loop sooner (left as an exercise). 9. You can save a few bytes by re-computing m every time: added over-head of m=1, but removes the ternary (so you can use m*=2) and means you can remove j completely (replace 1<<j++ with m). Should get you down to 159. (I'm a C#er, I would never post a Java answer! and anyway, nothing I've done is original; it's just golfing your method)

@VisualMelon Again, I'm not here sooo regularly, and it has been a while since I've been golfing on that level, so don't hesitate to post your solution (I'm pretty sure that you could have started from scratch and achieved a solution similar to mine, before squeezing even further bytes out of it).

J, 42 bytes
]`('v'I.@e.~[)`[}"1'v^'{~2#:@i.@^1#.e.&'v'

Try it online!
explanation
]`('v' I.@e.~ [)`[}"1 ('v^' {~ 2 #:@i.@^ 1 #. e.&'v')

Let take
-v-
-v-

as our example input.

('v^' {~ 2 #:@i.@^ 1 #. e.&'v') creates all possible combos of just the switches, ignoring the input format.  for our example it produces:
vv
v^
^v
^^

1 #. e.&'v' counts the numbers of vs in the input.
2 #:@i.@^ raises 2 to that power, produces the integers from 0 to that number i., and converts them to binary #:
'v^' {~ changes to binary digits to v and ^

]`('v' I.@e.~ [)`[}"1 amends the original input, producing one copy of it for each row of the result described in the previous step (ie, all possible v/^ combos).  In each copy the v of the original input are replaced with one possible  sequence of v/^.

C (gcc), 75 74 70 bytes
-5 byte thanks to @ceilingcat
*b=0;f(char*s){b=b?b:s;*s?f(s+1),*s>46?*s=94,f(s+1),*s='v':0:puts(b);}

Try it online!
requires the memory s points to to be writable

@cielingcat is correct: https://tio.run/##S9ZNT07@/z85I7FIK8nWwDpNA8ws1qxOsk2yT7IqttYqtk/TKNY21NTRKrYzMbPXKra1NNGBC9mql6lbGVgVlJYUayRpWtf@z03MzNPQrAYZo1AcHWurpFsGhjF5YEoJaEUxSB0A

@BrianMinton indeed. and i would never have thought of trying this. nice!

J, 41 40 24 bytes
[:>@,@{<@(,'^'$~'v'=])"0

Try it online!

very impressive.  love the use of {.  although i think [:>@,@{<@(,'^'$~'v'=])"0 would be slightly more fair since "Each output board should be of the exact same format as the input" and the input isn't boxed.

@Jonah thanks. corrected.

Python 2, 87 bytes
def f(s):i=s.find('v');return(i>=0and f(s[:i].replace('^','v')+'^'+s[i+1:])+'\n'or'')+s

Try it online!
A non-regex approach.

A way more concise approach than mine, nice work!

Python 3.8 (pre-release), 129 117 116 110 106 bytes
-10 bytes thanks to @Chas Brown
f=lambda s:{s.replace('v','{}').format(*['v^'[c<'1']for c in bin(x+i)[::-1]])for i in range(x:=1<<len(s))}

Try it online!

Welcome to PPCG! 123 bytes using a similar idea.

119 bytes (previously wrong link in this comment).

C (gcc), 102 bytes
i,j,l;f(char*s){for(l=j=0;l++<1<<j;puts(""))for(i=j=0;s[i];i++)putchar(s[i]>64?l&1<<j++?118:94:s[i]);}

Try it online!

K4, 44 bytes
Solution:
-1{@[x;&w;:;]@'"v^"@a\:'!*/a:(+/w:"v"=x)#2};

Examples:
q)k)-1{@[x;&w;:;]@'"v^"@a\:'!*/a:(+/w:"v"=x)#2}"-v-";
-v-
-^-

q)k)-1{@[x;&w;:;]@'"v^"@a\:'!*/a:(+/w:"v"=x)#2}"-v-\n-v-";
-v-
-v-
-v-
-^-
-^-
-v-
-^-
-^-

q)k)-1{@[x;&w;:;]@/:"v^"@a\:'!*/a:(+/w:"v"=x)#2}"-v-v-\n-v-v-v-\n-v-";
-v-v-
-v-v-v-
-v-
-v-v-
-v-v-v-
-^-
-v-v-
-v-v-^-
-v-
-v-v-
-v-v-^-
-^-
-v-v-
-v-^-v-
-v-
-v-v-
-v-^-v-
-^-
-v-v-
-v-^-^-
-v-
-v-v-
-v-^-^-
-^-
-v-v-
-^-v-v-
-v-
-v-v-
-^-v-v-
-^-
-v-v-
-^-v-^-
-v-
-v-v-
-^-v-^-
-^-
-v-v-
-^-^-v-
-v-
-v-v-
-^-^-v-
-^-
-v-v-
-^-^-^-
-v-
-v-v-
-^-^-^-
-^-
-v-^-
-v-v-v-
-v-
-v-^-
-v-v-v-
-^-
-v-^-
-v-v-^-
-v-
-v-^-
-v-v-^-
-^-
-v-^-
-v-^-v-
-v-
-v-^-
-v-^-v-
-^-
-v-^-
-v-^-^-
-v-
-v-^-
-v-^-^-
-^-
-v-^-
-^-v-v-
-v-
-v-^-
-^-v-v-
-^-
-v-^-
-^-v-^-
-v-
-v-^-
-^-v-^-
-^-
-v-^-
-^-^-v-
-v-
-v-^-
-^-^-v-
-^-
-v-^-
-^-^-^-
-v-
-v-^-
-^-^-^-
-^-
-^-v-
-v-v-v-
-v-
-^-v-
-v-v-v-
-^-
-^-v-
-v-v-^-
-v-
-^-v-
-v-v-^-
-^-
-^-v-
-v-^-v-
-v-
-^-v-
-v-^-v-
-^-
-^-v-
-v-^-^-
-v-
-^-v-
-v-^-^-
-^-
-^-v-
-^-v-v-
-v-
-^-v-
-^-v-v-
-^-
-^-v-
-^-v-^-
-v-
-^-v-
-^-v-^-
-^-
-^-v-
-^-^-v-
-v-
-^-v-
-^-^-v-
-^-
-^-v-
-^-^-^-
-v-
-^-v-
-^-^-^-
-^-
-^-^-
-v-v-v-
-v-
-^-^-
-v-v-v-
-^-
-^-^-
-v-v-^-
-v-
-^-^-
-v-v-^-
-^-
-^-^-
-v-^-v-
-v-
-^-^-
-v-^-v-
-^-
-^-^-
-v-^-^-
-v-
-^-^-
-v-^-^-
-^-
-^-^-
-^-v-v-
-v-
-^-^-
-^-v-v-
-^-
-^-^-
-^-v-^-
-v-
-^-^-
-^-v-^-
-^-
-^-^-
-^-^-v-
-v-
-^-^-
-^-^-v-
-^-
-^-^-
-^-^-^-
-v-
-^-^-
-^-^-^-
-^-

Explanation:
In-place replacement of "^". Determine number of combinations of switches (e.g. 2^n), count up in binary, replace switches...
-1{@[x;&w;:;]@'"v^"@a\:'!*/a:(+/w:"v"=x)#2}; / the solution
-1                                         ; / print to STDOUT, swallow -1
  {                                       }  / lambda taking implicit x
                                        #2   / take 2
                             (         )     / do this together
                                  "v"=x      / does input = "v" ?
                                w:           / save as w
                              +/             / sum up
                           a:                / save as a
                         */                  / product
                        !                    / range 0..n
                    a\:'                     / convert each to base-2
               "v^"@                         / index into "v^"
             @'                              / apply each
   @[x;&w;:;]                                / apply assignment to x at indexes where w is true

R, 116 bytes
function(x,u=utf8ToInt(x))apply(expand.grid(rep(list(c(118,94)),sum(u>45))),1,function(i)intToUtf8(`[<-`(u,u>45,i)))

Try it online!
Function returning a vector of newline separated boards

ah, I was so focused on taking input in a much harder way that I neglected the ease of this one. Nice use of "[<-"!

@Giuseppe: I'm not very satisfied by this solution... but I tried to generate the combinations in other ways (e.g. using binary conversion) but this ended up being the shortest.

JavaScript, 88 bytes
s=>(g=n=>n--?g(n)+`
`+s.replace(/v/g,_=>'v^'[i=n&1,n>>=1,i]):'')(2**~-s.split`v`.length)

Try it online!

n>>=1 -> n/=2

Retina 0.8.2, 29 bytes
T`¶v`;#
+%1`#
v$'¶$`^
%`;|$
¶

Try it online! Explanation:
T`¶v`;#

Change the newlines into ;s and the vs into # markers.
+%1`#

Replace the #s one at a time from left to right.
v$'¶$`^

Change each line into two lines, one with the # replaced with a v, one with it replaced with a ^.
%`;|$
¶

Change the ;s back into newlines and space the results apart.

Perl 5 -0, 51 bytes
$_=<>;s/\s/P/g;s/v/{v,^}/g;say s/P|$/\n/gr for glob

Try it online!

40 (Version1) 40 (Version 2)

39
38
32 29

Oh, basic tip: Using -n would have avoided the need for $_=<>;

JavaScript (Node.js), 80 73 68 bytes
f=([x,...y],g=c=>f(y).map(z=>c+z))=>x?g(x).concat(x>'a'?g`^`:[]):[y]

Try it online!

Python 3 - construct, 203 bytes
def f(a):
 b=[0]
 for l in a.split():b+=[b[-1]+l.count('v')]
 return'\n'.join(''.join(f"{k:b}".zfill(b[-1])[x:y]+'-\n'for x,y in zip(b,b[1:]))for k in range(2**b[-1])).replace('0','-v').replace('1','-^')

Try it online!
First try, not very small but works. There is no elegant string replacement in Python...
The First loop builts a mapping of lines to bit indices, i.e. for each line, the index of the first bit in a bit counter is stored. This is used for indexing the bit counter in the next loop.
The Second loop runs a binary counter, extracts the bits for each line and iteration and joins them. After joining everything together, it is translated back to the switch map format, using string replacement.
I guess, there is a more elegant way by reusing the input string instead of rebuilding it over and over again.
Edit: inspired by the Python 3.8 answer, here is a much shorter replacing version
Python 3 - replace, 123 bytes
def f(a):r=range;n=a.count('v');return'\n'.join(a.replace('v','{}').format(*('v^'[k&2**i>0]for i in r(n)))for k in r(2**n))

Try it online!

Ruby, 64 bytes
Returns an array. Gets numbers from \$1\$ to \$2^v\$ (where \$v\$ is the number of "v" in the input) and flips switches based on the \$v\$ least significant bits. This allows us to save a byte over iterating from \$0\$ to \$2^v-1\$, because the \$v\$ least significant bits in \$2^v\$ are all zero.
In Ruby, i[j] returns the jth bit of i starting from the least significant bit, aka it is equivalent to (i>>j)&1.
->s{(1..2**s.count(?v)).map{|i|j=-1;s.gsub(/v/){'v^'[i[j+=1]]}}}

Try it online!

Charcoal, 28 bytes
⪫ＥＸ²№θv⭆θ⎇⁼λv§v^÷ιＸ²№…θμvλ¶¶

Try it online! Link is to verbose version of code. Explanation:
   ²                            Literal 2
  Ｘ                             Raised to power
    №                           Count of
      v                         Literal `v`
     θ                          In input string
 Ｅ                              Map over implicit range
        θ                       Input string
       ⭆                        Map over characters and join
           λ                    Current character
          ⁼                     Equal to
            v                   Literal `v`
         ⎇                      Then
              v^                Literal `v^`
             §                  Circularly indexed by
                 ι              Outer index
                ÷               Integer divided by
                   ²            Literal 2
                  Ｘ             Raised to power
                    №           Count of
                        v       Literal `v`
                      θ         In input string
                     …          Truncated to length
                       μ        Inner index
                         λ      Else current character
⪫                         ¶¶    Join with newlines
                                Implicitly print

PHP, 93 bytes
for(;$j<1<<$x;$j+=print$s)for($x=0,$s=$argv[1];$i=strpos($s,v,$i+1);$s[$i]=$j&1<<$x++?'^':v);

Try it online!
Standalone program, input via command line.
Loop the number of possible permutations of the input string based on the number of v's.  While counting up in binary, replace each binary 1 with a ^ and each binary 0 with a v in the input string.


text:
What are some of the most character-efficient programming languages?
Like Brainfuck or JSFuck would be efficient in terms of number of characters needed, but what languages would have the highest amount of information per character?
I was thinking of APL and J but there has to be more.
My goal with this question is to find a program that would allow a person with theoretically infinite amounts of computational power output through their fingers a program in the least amount of time possible.

I voted to close this as too broad, since I don't think a question like this is really on-topic anywhere on the stack exchange network. If you were able to provide a way to measure information you might have more luck on one of the other sites, like computer science. But please read their help centre before you post! You may also find that asking for things like this in chat will work better, once you have enough reputation points.

Probably Jelly, but there’s no real way to objectively measure that, and it doesn’t always win everything—if there was one Objectively Most Efficient Language then this site would be a lot more boring. Also, if you really mean characters and not bytes, then... you could probably just get away with compressing Jelly into Unicode

This question will be closed because it is not a challenge. I would recommend asking questions like this in chat!

You can find a list of all languages designed for code golf here: https://github.com/ETHproductions/golfing-langs . Of those listed, Jelly, 05AB1E, and Stax are top contenders, with many languages including Canvas and (my newly created language) Sledgehammer also winning sometimes.

Since this is a code-golf question, I feel like golfing the markdown sample answer given in the question anyway: Find a Turing-complete program allowing rapid development. (58 bytes)

RE: your edit - you are basically asking what programming language is best at winning challenges on this site. Seeing as different languages win different challenges, there would be no one correct answer. Usually, people do not care about runtime anyway, if they can save a byte or two.

do you mean characters or bytes? Most golfing languages on this site are judged by bytes, rather than characters.

Related

You might be interested in language golfing Elo ratings.


text:
Inverse Colombian Function
Let's define a sequence: The n digit summing sequence (n-DSS) is a sequence that starts with n. If the last number was k, then the next number is k + digit-sum(k). Here are the first few n-DSS:
1-DSS: 1, 2, 4, 8, 16, 23, 28, 38, 49, 62, 70...
2-DSS: 2, 4, 8, 16, 23, 28, 38, 49, 62, 70, 77...
3-DSS: 3, 6, 12, 15, 21, 24, 30, 33, 39, 51, 57...
4-DSS: 4, 8, 16, 23, 28, 38, 49, 62, 70, 77, 91...
5-DSS: 5, 10, 11, 13, 17, 25, 32, 37, 47, 58, 71...
6-DSS: 6, 12, 15, 21, 24, 30, 33, 39, 51, 57, 69...
7-DSS: 7, 14, 19, 29, 40, 44, 52, 59, 73, 83, 94...
8-DSS: 8, 16, 23, 28, 38, 49, 62, 70, 77, 91, 101...
9-DSS: 9, 18, 27, 36, 45, 54, 63, 72, 81, 90, 99...

For 1, this is A004207, although the first few digits are different due to a slightly different definition. For 3, it's A016052; for 9, A016096.
Today's challenge is to find the lowest n digit sum sequence that a given number appears in. This is called the "Inverse Colombian Function", and is A036233. The first twenty terms, starting with 1 are:
1, 1, 3, 1, 5, 3, 7, 1, 9, 5, 5, 3, 5, 7, 3, 1, 5, 9, 7, 20

Some other good test cases:
117: 9
1008: 918

You only have to handle integers greater than 0, and you can take input and output in any standard format. As usual, this is code-golf, so shortest answer in each language wins.

Related

Haskell, 104 64 63 bytes
(-26 thanks to H.PWiz, additional -14 thanks to Sriotchilism O'Zaic, additional -1 thanks to cole)
This is a function.
f x=[y|y<-[1..],x==until(>=x)(foldr((+).read.pure)<*>show)y]!!0

Try it online!

Explanation:
(foldr((+).read.pure)<*>show)

Sequence of composited functions that returns y+digital sum of y. Converts to string first, then does some monad gymnastics to get the sum of the characters and the original number (thanks to Cole).
The <*> operator in this context has type and definition
(<*>) :: (a -> b -> c) -> (a -> b) -> c
f <*> g = \x -> f x (g x)

so we can write the above as
\x -> foldr ((+) . read . pure) x (show x)

This read . pure converts a Char into a number, so (+) . read . pure :: Char -> Int -> Int adds a digit to an accumulated value. This value is initialized to the given number in the fold.
until (>=x) {- digital sum function -} y

until repeatedly applies a function to its result (in this case, the y+digital sum y) until it meets a requirement specified by a function in the first argument. This gives the smallest y-DSS element that's greater or equal to x.
[y | y<-[1..]; x == {- smallest y-DSS element >= x -} ]

Infinite lazy list of y's such that the smallest y-DSS element >= x is actually x. Uses Haskell's list comprehension notation (which I'd also totally forgotten about, thank y'all).
f x = {- aforementioned list -} !! 0

First element of that list, which is the smallest y that satisfies the requirement of the challenge.

Here is how I golfed it.

@H.PWiz This should be the same no?  I would think so but your use of fmap in the first place confuses me a bit.

OK it took a lot of fenangling but I abused the reader monad to shave off a single byte. Woohoo pointfree code! TIO

@SriotchilismO'Zaic Cool. I just golfed the code mechanically, without thinking about it

Not sure how to edit request on mobile so I just edited in an explanation of my code - feel free to change or roll back.

@cole thanks for adding that! I'd seen your comment while rushing to work so I wanted to incorporate it but didn't quite have the bandwidth to try to understand it fully...

Python 2, 73 71 bytes
-2 bytes thanks to Erik.
n=input();k=K=1
while n-k:K+=k>n;k=[k+sum(map(int,`k`)),K][k>n]
print K

Try it online!

-2 by not assigning l to k>n.

Perl 6, 44 bytes
->\a{+(1...{a∈($_,{$_+.comb.sum}...*>a)})}

Try it online!
Naive solution that checks every sequence until it finds one that contains the input
Explanation:
->\a{                                    }  # Anonymous code block taking input as a
     +(1...{                           })   # Find the first number
            a∈(                       )     # Where the input is an element of
                                ...         # The sequence
               $_,                          # Starting with the current number
                  {            }   # Where each element is
                   $_+             # Is the previous element plus
                      .comb.sum    # The digit sum
                                   *>a      # Until the element is larger than the input

Jelly, 11 bytes
D+ƒ$Ð¡€œi⁸Ḣ

Try it online!
Full program.

Ruby, 51 bytes
->n{(1..n).find{|i|i+=i.digits.sum while i<n;i==n}}

Try it online!

MATL, 18 bytes
`@G:"ttFYAs+]vG-}@

Try it online! Or verify the first 20 values.
Explanation
For input i, this keeps increqsing n until the first i terms of n-th sequence include i. It is sufficient to test i terms for each sequence because the sequence is increasing.
`         % Do...while
  @       %   Push iteration index, n. This is the firsrt term of the n-th sequence
  G:      %   Push [1 2 ... i], where i is the input
  "       %   For each (i.e., do the following i times)
    tt    %     Duplicate twice
    FYA   %     Convert to digits
    s     %     Sum
    +     %     Add to previous term. This produces a new term of the n-th sequence
  ]       %   End
  v       %   Concatenate all terms into a column vector
  G-      %   Subtract i, element-wise. This is the do...while loop condition (*).
}         % Finally (this is executed right before exiting the loop)
  @       %   Push current n. This is the output, to be displayed
          % End (implicit). A new iteration will start if all terms of (*) are nonzero
          % Display (implicit)

Pyth, 13 bytes
fqQ.W<HQ+ssM`

Try it here or check out the test suite.

How it works
fqQ.W<HQ+ssM`     Full program. Takes input Q from STDIN, writes to STDOUT.
f{...}            Loop over 1,2,3,... and find the first number to yield truthy results when
                     applying the function {...} (whose variable is T = the current integer).
 qQ.W<HQ+ssM`     The function {...}, which will be analysed separately.
   .W             Functional while. While condition A is true, do B.
     <HQ          Cond. A (var: H - starts at T): Checks if H is less than Q.
        +ssM`     Func. B (var: G - G & H are the same): If A, G & H become G+digit sum(G)
                  The last value of this functional while will be the least possible number N
                  in the T-DSS that is greater than or equal to Q.
                  If N = Q, then Q ∈ T-DSS. Else (if N > Q), then Q ∉ T-DSS.
 q                That being said, check whether N == Q.

In most languages, it would be easier to loop on the set of the natural numbers, find the first \$n\$ terms of the \$k\$-DSS (because the digit sum is always at least  \$1\$ so the repeated addition of this type of quantity cannot result in a value smaller than \$n\$) and check if \$n\$ belongs in those first \$n\$ terms of the \$k\$-DSS. In Pyth, however, the available control-flow structures actually make it easier to generate terms until a certain condition is met, rather than a fixed number of terms.

Nicely done, I had fqQ.W<HQ+sjZ10 for 14. I keep forgetting about ` and s as a way of getting digits from an integer!

Forth (gforth), 106 bytes
: f
>r 0 begin 1+ dup begin dup i < while dup begin 10 /mod >r + r> ?dup 0= until repeat i = until rdrop
;

Try it online!
Code Explanation
: f                \ start a new word definition
  >r               \ store the input on the return stack for easy access
  0                \ set up a counter
  begin            \ start an indefinite loop
    1+ dup         \ add 1 to the counter and duplicate
    begin          \ start a 2nd indefinite loop
      dup i <      \ check if current value is less than the input value
    while          \ if it is, continue with the inner loop
      dup          \ duplicate the current value
      begin        \ innermost loop, used to get the digit-wise sum of a number
        10 /mod    \ get quotient and remainder of dividing by 10
        >r + r>    \ add remainder to current list value
        ?dup 0=    \ check if quotient is 0
      until        \ end the innermost loop if it is
    repeat         \ go back to the beginning of the 2nd loop
    i =            \ check if the "last" value of the current list = the input value
  until            \ if it does, we're done
  rdrop            \ remove the input value from the return stack
;                  \ end the word definition

Jelly, 9 bytes
DS+)i$ƬṖṪ

A monadic Link accepting a positive integer n which yields a positive integer, a(n), the Inverse Colombian of n.
Try it online! Or see the test-suite.
How
Effectively we work backwards, repeatedly looking for the value we added to until we cannot find one:
DS+)i$ƬṖṪ - Link: integer n
      Ƭ   - Repeat until a fixed point, collecting up:
     $    -   last two links as a monad - f(n):
   )      -     left links as a monad for each - [g(x) for x in [1..n]]:
D         -       decimal digits of x
 S        -       sum
  +       -       add x
    i     -     first (1-indexed) index of n in that list, or 0 if no found
       Ṗ  - pop of the rightmost value (the zero)
        Ṫ - tail

Using 13 as an example...
D  )  = [[1],[2],[3],[4],[5],[6],[7],[8],[9],[1,0],[1,1],[1,2],[1,3]]
 S    = [  1,  2,  3,  4,  5,  6,  7,  8,  9,    1,    2,    3,    4]
  +   = [  2,  4,  6,  8, 10, 12, 14, 16, 18,   11,   13,   15,   17]
    i 13 = .......................................... 11
    i 11 = .................................... 10
    i 10 = ............... 5
    i 5 = not found = 0
    i 0 = not found = 0
    Ƭ -> [13, 11, 10, 5, 0]
    Ṗ =  [13, 11, 10, 5]
    Ṫ =               5

Python 2, 85 bytes
f=lambda n,a=[]:n in a and a.index(n)or f(n,[k+sum(map(int,`k`))for k in a]+[len(a)])

Try it online!
This certainly works for all the test cases, plus all of the 1..88 entries given at OEIS; but still I'm not quite sure it's provably correct. (This is one of my complaints regarding the Church Of Unit Testing :)).

This is hardly a truly rigorous proof but: Let $d(x)$ be the digits of $x$ and $C_i(s)$ be the Columbian function starting from $i$ after taking $s$ steps, that is, $C_i(0)=i; C_i(s)=C_i(s-1)+\Sigma d(C_i(s-1))$. Now, for any $x>1$ it holds that $\exists e\in d(x) (e\geq1)$ and $\forall e\in d(x) (e\geq0)$, which means that $\Sigma d(x)\geq1$. (1/2)

Now, define $S(i)$ such that $C_i(S(i))=n$. Because of our earlier conclusion $\Sigma d(C_i(s-1))\geq1$, we can intuit that for any $i<i'\leq n$ where $S(i),S(i')$ are defined, $S(i')-S(i)\leq i'-i$. This leads to the conclusion that for your function, the smallest such index $i$ will equal $n$ in at most as many steps as it takes to reach the next such $i$, in which case a.index(n) will prioritize the smaller of the two. (2/2)

@Value Ink: Roger! That totally works. Thanks!

Wolfram Language (Mathematica) 14.0+, 61 48 bytes
Min@Position[Range@#//.j_/;j<#:>j+DigitSum@j,#]&

Try it online!
As of version 14.0, DigitSum finally exists. Since TIO is on 12.0.1, the linked version uses Tr@IntegerDigits (+8 bytes) instead.

MathGolf, 13 bytes
╒môk(É∙Σ+=k/)

Try it online!
Great challenge! It caused me to find a few bugs within the implicit pop behavior of MathGolf, which added 1-2 bytes to the solution.
Explanation (using input \$3\$)
╒               range(1,n+1) ([1, 2, 3])
 mô             explicit map using 6 operators
   k(           push input-1 to TOS
     É          start block of length 3 (repeat input-1 times)
      ∙Σ+       triplicate TOS, take digit sum of top copy, and add that to second copy
                This transforms the array items to their respective sequences instead
                Array is now [1, 2, 4, 2, 4, 8, 3, 6, 12]
         =      get index of element in array (the index of 3 is 6)
          k/    divide by input (gives 2)
            )   increment (gives the correct answer 3)

To prove that this will always work, it is easy to see that n <= input, because input is the first element of the inputth sequence. I have technically not proved that this solution is always valid, but it does pass every test case that I have tested.

05AB1E, 13 bytes
L.ΔIGÐSO+})Iå

Try it online!

Japt, 15 14 bytes
The ternary to handle cases where input=output is annoying me!
@Ç?X±ìx:XÃøU}a

Try it
@Ç?X±ìx:XÃøU}a     :Implicit input of integer U
@                  :A function taking an integer X as its argument
 Ç                 :  Map each Z in the range [0,U)
  ?                :    If Z>0
   X±              :      Increment X by
     ì             :      Convert X to digit array
      x            :      Reduce by addition
       :X          :    Else X
         Ã         :  End map
          øU       :  Contains U
            }      :End function
             a     :Return the first integer that returns true when passed through that function

Clean, 86 bytes
import StdEnv
$n=hd[i\\i<-[1..]|n==while((>)n)(\j=j+sum[toInt d-48\\d<-:toString j])i]

Try it online!
Expanded:
$ n                    // function `$` of `n` is
 = hd [                // the first
   i                   // integer `i`
  \\                   // for
   i <- [1..]          // each integer from 1 upwards
  |                    // where
   n ==                // `n` is equal to
   while ((>) n) (     // the highest value not more than `n` from
    \j = j + sum [     // `j` plus the sum of
      toInt d - 48     // the digital value
     \\                // for each
      d <-: toString j // digit in the string form of `j`
     ]                 // where `j` is the previous term
    )                  // of the sequence
   i                   // starting with term `i`
  ]

It bothers me that digitToInt d is longer than toInt d-48

C (gcc), 102 bytes
f(n,i,s){for(i=1;n^s;)for(s=i++;s<n;){char*p,j=0,l=asprintf(&p,"%d",s);for(;j<l;)s+=p[j++]-48;}n=~-i;}

Try it online!

JavaScript, 65 bytes
n=>eval('for(i=p=1;n-p;p=p>n?++i:p)for(j=p;j;j=j/10|0)p+=j%10;i')

Try it online!

It also works as C, but cost one more byte
C (gcc), 66 bytes
i,p,j;f(n){for(i=p=1;n-p;p=p>n?++i:p)for(j=p;j;j/=10)p+=j%10;n=i;}

Try it online!

C# (Visual C# Interactive Compiler), 83, 82 bytes
n=>Enumerable.Range(1,n).First(x=>{for(;x<n;x+=(x+"").Sum(c=>c-48));return x==n;})

Try it online!

82 bytes

@ExpiredData ah yes how did I forget using the literal value x)

cQuents, 18 bytes
#|1:#bN;A
=A?Z+UDZ

Try it online!
Explanation
=A?Z+UDZ      second line - helper function
               first input = A
               second input = n
=A            first term is A
  ?           mode=query, return true if n in sequence, false if n not in sequence
              each term in the sequence equals
   Z+          previous term +
     U   )                     sum (                          )
      D )                            digits (               )
       Z                                      previous term

#|1:#bN;A     main program
               first input = A  (user input)
               second input = n
#|1           n = 1
   :          mode=sequence, return the nth term in the sequence
    #     )   conditional - next term equals next N that evaluates to true
              N increments, any terms that evaluate to true are added to the sequence
               conditional (                      )
     b   )                   second line (      )
      N;A                                  N, A

Husk, 14 10 bytes
-4 thanks to @H.PWiz
V£⁰m¡SF+dN

Try it online!

Here is 10 bytes: €mΩ≥¹SF+dN (I still feel that there is shorter)

Or V£⁰m¡SF+dN

Forth (gforth), 99 bytes
: f >r 0 begin 1+ dup begin dup i < while dup 20 for 10 /mod >r + r> next + repeat i = until r> . ;

Try it online!
Largely similar to reffu's submission (106 bytes). The golfed parts are:

Digit sum calculation (-6)
Final cleanup (-1) by printing some garbage to stdout. (No problem because the result is returned on the top of the stack.)

How it works
: dsum ( n -- n+digitsum ) \ Sub-function. Given n, add its digit sum to n.
  dup                      \ Copy n to form ( n m ) -> extract digits from m and add to n
  20 for                   \ Repeat 20 times (a 64-bit int is at most 20 digits)
    10 /mod >r + r>        \   n += m%10, m = m/10
  next + ;                 \ End loop and discard 0

: f ( n -- ans )    \ Main function.
  >r                \ Move n to the return stack, so it can be referenced using `i`
  0 begin 1+        \ Initialize counter and loop starting from 1
    dup begin       \   Copy the counter (v) and loop
      dup i < while \     break if v >= n
      dsum          \     v += digit sum of v
    repeat          \   End loop
  i = until         \ End loop if n == v
  r> . ;            \ Cleanup the return stack so the function can return correctly
                    \ `r> .` is one byte shorter than `rdrop`

Red, 103 bytes
func[n][m: 1 loop n[k: m until[if k = n[return m]s: k
foreach d to""k[s: s + d - 48]n < k: s]m: m + 1]]

Try it online!

Charcoal, 26 bytes
ＮθＷ¬№υθ«ＵＭυ⁺κΣκ⊞υ⊕Ｌυ»Ｉ⊕⌕υθ

Try it online! Link is to verbose version of code. Uses @ChasBrown's algorithm. If that turns out to be invalid, then for 29 bytes:
ＮθＷ¬№υθ«≔⊕ＬυηＷ‹ηθ≧⁺Σηη⊞υη»ＩＬυ

Try it online! Link is to verbose version of code. Works by calculating the first member of each digit summing sequence not less than n. Explanation:
Ｎθ

Input n.
Ｗ¬№υθ«

Loop until we find a digit summing sequence containing n.
≔⊕Ｌυη

The next sequence begins with one more than the number of sequences so far.
Ｗ‹ηθ

Loop while the member of the sequence is less than n.
≧⁺Σηη

Add the digit sum to get the next member of the sequence.
⊞υη

Push the final member to the list.
»ＩＬυ

Print the number of lists computed until we found one containing n.

CJam, 25 bytes
q~:T,{[){__Ab:++}T*]T&}#)

Try it online!

Gaia, 16 bytes
1⟨⟨:@<⟩⟨:Σ+⟩↺=⟩#

Try it online!
Returns a list containing the smallest integer.
1⟨	      ⟩#	% find the first 1 positive integers where the following is truthy:
	     =		% DSS equal to the input?
  	    ↺		% while
  ⟨:@<⟩			% is less than the input
       ⟨:Σ+⟩		% add the digital sum to the counter

Gaia, 16 bytes
1⟨w@⟨:):Σ++⟩ₓĖ⟩#

Try it online!
Uses the observation made by Mr. Xcoder. It's not shorter than the other, but it's an interesting approach nonetheless.
1⟨	      ⟩#	% find the first 1 integers z where:
  	     Ė		% the input (n) is an element of
  w@⟨:):Σ++⟩ₓ		% the first n terms of the z-th Digital Sum Sequence

Gaia, 16 bytes
┅ẋ⟨@⟨:):Σ++⟩ₓĖ⟩∆

Try it online!
Third approach not using N-find, #, but still relying on the same observation as the middle approach. Returns an integer rather than a list.

Clojure, 106 bytes
#(loop[j 1 i 1](if(= j %)i(if(< j %)(recur(apply + j(for[c(str j)](-(int c)48)))i)(recur(inc i)(inc i)))))

Try it online!
This is 99 bytes but results in Stack Overflow on larger inputs (maybe tweaking the JVM would help):
#((fn f[j i](if(= j %)i(if(< j %)(f(apply + j(for[c(str j)](-(int c)48)))i)(f(inc i)(inc i)))))1 1)

ink, 130 127 bytes
-(l)
+(i)[+]->l
*(w)[{i}]
~temp n=w
-(o){n<i:
~n+=s(n)
->o
}{n>i:->w}{w}
==function s(n)
{n>9:
~return n%10+s(n/10)
}
~return n

Try it online!

-3 bytes by converting to a full program which takes unary input.

This feels too long to not be golfable.
Ungolfed
// This program takes unary input. It passes through the same choice prompt as long as it recieves 1, and execution begins when it recieves 2
-(input_loop)
+(input_value)[+] -> input_loop                 // When this option (option 1) is selected, its read count is incremented. We can access this via the "input_value" variable. We then return to the prompt by going back to the "input_loop" gather
*(which_sequence)[{i}]                          // When this option (option 2) is selected, execution begins. Its read count also serves to keep track of which DSS we're checking.
~temp current_value = which_sequence            // The initial value for the n-DSS is n, of course.
-(sequence)                                     //
{current_value < input_value:                   // If we're still below the value we're looking for, we might find it.
    ~ current_value += digit_sum(current_value) // To get the next number, we add the current number's digit sum
    -> sequence                                 // Then we loop
}
{n > i: -> which_sequence}                      // If we get here, we're at or above our target number. If we're above it, we know it's the wrong sequence and move on to the next one by going back up to option 2. This increments its read count.
{which_sequence}                                // If we get here, we've found the target number, so we output the sequence's number.
// End of main stitch, program ends.

// A function to calculate the digit sum of a number
== function digit_sum(n) ==
{n > 9: // If given a number greater than 9, recurse
    ~ return (n % 10) + digit_sum(n / 10)
}
~ return n // Otherwise, return the input (it's a single digit)

C (gcc), 80 79 78 bytes
i,j;r;v;f(n){for(r=v=n;i=--r;v=n-i?v:r)for(;i<n;)for(j=i;i+=j%10,j/=10;);n=v;}

Try it online!
-2 from ceilingcat

C# (Visual C# Interactive Compiler), 75 bytes
n=>{int a=0,b=0;for(;b!=n;)for(b=++a;b<n;)b+=(b+"").Sum(x=>x-48);return a;}

Try it online!

Perl 5 -MList::Util=sum -p, 57 bytes
map{$;=$_;"@F"-($_+=sum/./g)or$\||=$;while"@F">$_}1..$_}{

Try it online!


text:
Another version of "The Bridge and Torch Problem"
The idea for this code golf puzzle is from link: The Bridge and Torch Problem

The inspiration for this code golf puzzle is the Bridge and Torch
  problem, in which d people at the start of a bridge must all cross it
  in the least amount of time.
The catch is that at most two people can cross at once, otherwise the
  bridge will crush under their weight, and the group only has access to
  one torch, which must be carried to cross the bridge.
Each person in the whole puzzle has a specified time that they take to
  walk across the bridge. If two people cross together, the pair goes as
  slow as the slowest person.

For this challenge d=4 and for the input you will get a time t and a list of tuple like:

input = (19,[('A', 1), ('B', 3), ('C', 4), ('D', 5)])

Now the task is to find all possible solution how they can cross the bridge within the time t. Solve the problem in the fewest bytes of code possible.
For example for this input:

input =(19,[('A', 1), ('B', 2), ('C', 5), ('D', 10)])

Your solution should look like:

Solution
['Couple A and B cross the bridge']
[' A goes back']
['Couple D and C cross the bridge']
[' B goes back']
['Couple A and B cross the bridge']
Solution
['Couple A and B cross the bridge']
[' A goes back']
['Couple D and A cross the bridge']
[' A goes back']
['Couple C and A cross the bridge']
Solution
['Couple A and B cross the bridge']
[' A goes back']
['Couple C and A cross the bridge']
[' A goes back']
['Couple D and A cross the bridge']
Solution
['Couple A and C cross the bridge']
[' A goes back']
['Couple D and A cross the bridge']
[' A goes back']
['Couple A and B cross the bridge']
Solution
['Couple A and C cross the bridge']
[' A goes back']
['Couple A and B cross the bridge']
[' A goes back']
['Couple D and A cross the bridge']
Solution
['Couple A and D cross the bridge']
[' A goes back']
['Couple C and A cross the bridge']
[' A goes back']
['Couple A and B cross the bridge']
Solution
['Couple A and D cross the bridge']
[' A goes back']
['Couple A and B cross the bridge']
[' A goes back']
['Couple C and A cross the bridge']

The output don't need to be in a specific format.

Welcome to the site.  It would be nice if you could be a little clearer on the output format.  Giving an example of valid output is nice but it only goes so far.  It would be nice if people did not have to guess as to what is expected.

In particular, a list of solutions, where each solution is a list of steps, where each step is a list of people who cross at once, should be allowed because we know every other step is returning.

This is a borderline dupe of the linked question. The only reason it might not be a dupe is that some languages might not find it as easy to work with lists of paths as with integers.