Bubble Programming Challenge: 4 – Count Characters

Challenge number 4…

This one’s fairly straight forward…

Once again, the premise is simple:

For a given string, input by the user, simply count the number of times each character appears in the string, and output the result.

For example, if the input string is: ‘Good Morning’, the output should be:

g: 2
o: 3
d: 1
m: 1
r: 1
n: 2
i: 1

The output can be in alphabetical order, or (as in the example above) in the order the characters appear in the original string.

Capitalization is ignored, as are spaces, but punctuation can be included.

Here’s a working example: Count Characters (bubbleapps.io)

Remember, the challenge is to use vanilla Bubble only - no plugins or custom code.

Have fun :slight_smile:

5 Likes

(a) Solution

EDIT: updated to only be two elements and doesn’t use filter

3 Likes

Done
preview : tutorial_bubble

1 Like

I tried to anticipate which challenge you would do next, @adamhholmes, and I guessed incorrectly. So, here was me solving an anagram challenge earlier today.

nope

yup

I will do the character count challenge later. :slight_smile:

5 Likes

Just updated this so there’s one less repeating group. Now I think it’s as simple as one can make it… An input, repeating group, text to display the count, no workflows.
CleanShot 2023-07-28 at 23.51.34@2x

No doubt some Bubbler here will perform some witchcraft to display it with just two elements :laughing:

2 Likes

Love the idea of these challenges @adamhholmes.

Here’s mine :slight_smile:

Demo

Editor

1 Like

@eli If you add a full stop, it will say the full stop appears (the number of characters in the string) times, but nothing a quick Regex change can’t fix :wink:

2 Likes

So it does! Damn you regex

Fixed it… I think :joy:

1 Like

For me now it only counts letters, which to be honest is all that matters but the challenge is technically to include punctuation (hint: all non-whitespace characters)

1 Like

Well shit, I wanted to go regex only without using filter. Punctuation is causing issues though.

1 Like

Looks like you fixed it. You can get rid of the find and replace part of your expression - your regex does that for you!

1 Like

True. I’m gonna keep playing with it. I think I can get it done without the filter.

2 Likes

Actually… an anagram challenge was on my list of possibilities… and is definitely a good challenge to do… so you’re one step ahead now!!

1 Like

Yep, got it done with Regex only.

1 Like

Yep same. Now it’s a two element solution :laughing:

CleanShot 2023-07-29 at 00.22.40@2x

2 Likes

Okay, I did the correct challenge this time.

That trick from Gaby in the first challenge is worth its weight in gold.

Same editor link as the others, @adamhholmes, and you can see the anagram setup, too.

2 Likes

This is fun :grin:

2 Likes

Thanks @adamhholmes !
0 workflows, 0 actions and 2 elements for us (input field & output text).
We utilised regex, find & replace and unique elements.
Editor here and demo here for those interested.

1 Like

@josh23 You’ve got the same full stop edge case that Eli had :wink:

2 Likes