7 kyu
The Baby Years I - Baby Counting
244 of 725PG1
Description:
You've had a baby.
Well done. Nice isn't it? Life destroying... but in a good way.
Part of your new routine is lying awake at night worrying that you've either lost the baby... or that you have more than 1!
Given a string of words (x), you need to calculate how many babies are in it. To count as a baby you must have all of the letters in baby ('b', 'a', 'b', 'y'). That counts as 1. They do not need to be in order in the string. Upper and lower case letters count.
Examples:
"baby" = 1
"abby" = 1
"babybaby" = 2
"Why the hell are there so many babies?!" = 1
"Anyone remember life before babies?" = 1
"Happy babies boom ba by?" = 2
If there are no babies in the string - you lost the baby!! Return a different value, as shown below:
'none here' = "Where's the baby?!" '' = "Where's the baby?!"
Fundamentals
Strings
Similar Kata:
Stats:
Created | Oct 19, 2018 |
Published | Oct 19, 2018 |
Warriors Trained | 1364 |
Total Skips | 60 |
Total Code Submissions | 4173 |
Total Times Completed | 725 |
JavaScript Completions | 244 |
Python Completions | 307 |
Kotlin Completions | 196 |
Total Stars | 17 |
% of votes with a positive feedback rating | 92% of 213 |
Total "Very Satisfied" Votes | 184 |
Total "Somewhat Satisfied" Votes | 25 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |