Counter creates a dictionary, which is more convenient and is also faster.
Ruby 3.0 should be enabled, read this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
describe "<This message should describe the categories of test groups inside this block>" do
it "<A short message describing this test group>" do
expect(...).to eq(...) #Assertions
#Or Test.assert_equals(user_response, reference_response)
Ruby 3.0 should be enabled, see this to learn how to do it
Is there a reason to import this Counter instead of using the built-in count method for strings?
That is cool. I even did not know that we can use more than two ternary operators in return statement!
Added some time ago
It took me 2 days and 9 lines of code just to find out that someone made it in a single line. Inspiring and discouraging at the same time, lol. Congrats, dude. That's insane.
This comment is hidden because it contains spoiler information about the solution
Hint: precalculation / cache
haha, we solve the katas and then when we see other people solution done in one line, i am just shocked lol!
@StepBack13 sub/gsub aren't magic stick. Healthy newborn should swim by default.