Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

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.
  1. The input string should be one line and optionally contains the three varieties of Jimmys and optional whitespace.

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

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

  4. 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.

  5. 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.

  6. 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).
  1. 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).

  2. 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 , so lowest score in bytes wins.

Answer*

Draft saved
Draft discarded
Cancel
1
  • \$\begingroup\$ You can save some bytes by escaping less, since the string is guaranteed to be only jimmys: Try it online! \$\endgroup\$ Commented Jul 15, 2019 at 22:30

AltStyle によって変換されたページ (->オリジナル) /