← Back to challenges

Mumbling Challenge

JavaScriptHardlogicloopsstringsinterview

Instructions

Create a function that takes a string str and modifies the given string as per the below examples:

Examples

mumbling("MubAshIr") ➞ "M-Uu-Bbb-Aaaa-Sssss-Hhhhhh-Iiiiiii-Rrrrrrrr"

mumbling("maTT") ➞ "M-Aa-Ttt-Tttt"

mumbling("Sample") ➞ "S-Aa-Mmm-Pppp-Llllll-Eeeeee"

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Character Code Math