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.
oo /o\ o o
would be nice \$\endgroup\$oo
. \$\endgroup\$