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.
You can view the leaderboard for this post by expanding the widget/snippet below. In order for your post to be included in the rankings, you need a header (# header text
) with the following info:
The name of the language (end it with a comma
,
or dash-
), followed by...The byte count, as the last number to appear in your header.
For example, JavaScript (ES6), 72 bytes
is valid, but Fortran, 143 bytes (8-bit)
is invalid because the byte count is not the last number in the header (your answer will be recognized as 8 bytes - don't take advantage of this).
<!-- Run the snippet to see the leaderboard. Report any bugs to @xMikee1 on Github. --> <iframe src="https://ozewski.github.io/ppcg-leaderboard/?id=188391" width="100%" height="100%" style="border:none;">Oops, your browser is too old to view this content! Please upgrade to a newer version of your browser that supports HTML5.</iframe><style>html,body{margin:0;padding:0;height:100%;overflow:hidden}</style>
oo /o\ o o
would be nice \$\endgroup\$ – Veskah Jul 15 '19 at 17:10oo
. \$\endgroup\$ – recursive Jul 15 '19 at 18:42