https://github.com/NataliaRizzi/string-changes
Fork this repo and then git clone
your forked repo to your computer.
Once happy with your solution, git push
and submit a pull request at https://github.com/NataliaRizzi/string-changes
or send an email to natalia.rizzi88@gmail.com
Have the function StringChanges(str) take the str parameter being passed, which will be a string containing letters from the alphabet, and return a new string based on the following rules.
Whenever a capital M is encountered, duplicate the previous character (then remove the M), and whenever a capital N is encountered remove the next character from the string (then remove the N).
All other characters in the string will be lowercase letters. The final string will never be empty.
Input:"MrtyNNgMM"
Output:"rtyggg"
Input:"oMoMkkNrrN"
Output:"ooookkr"
To test your solution, run npm install
in the root directory and then run npm test
to run the automated tests.
You have 3 options to submit your solution:
- If you're working on a forked repo, push your changes to your forked repo and submit a pull request to this repo
- Send an email with your solution to
natalia.rizzi88@gmail.com
. - Send the solution on students slack channel.