Hashes and Pluses

Published by JJCUBER in

Create a function that returns the number of hashes and pluses in a string.

Examples

HashPlusCount("###+") ➞ [3, 1]

HashPlusCount("##+++#") ➞ [3, 3]

HashPlusCount("#+++#+#++#") ➞ [4, 6]

HashPlusCount("") ➞ [0, 0]

Notes

  • Return [0, 0] for an empty string.
  • Return in the order of [hashes, pluses].
Watch a quick demo on how Edabit works.