Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

1.2 KiB

id, title, challengeType, dashedName
id title challengeType dashedName
6a2037a68a0bc2aef0005fff Challenge 337: Tally Counter 28 challenge-337

--description--

Given a string of tally marks, return the total count represented.

  • Each pipe "|" represents one count.
  • Every fifth mark is represented as a forward slash "/", completing a group of five ("||||/").
  • Groups are separated by a space.

--hints--

getTallyCount("||||") should return 4.

assert.equal(getTallyCount("||||"), 4);

getTallyCount("||||/") should return 5.

assert.equal(getTallyCount("||||/"), 5);

getTallyCount("||||/ |||") should return 8.

assert.equal(getTallyCount("||||/ |||"), 8);

getTallyCount("||||/ ||||/ ||||/ ||") should return 17.

assert.equal(getTallyCount("||||/ ||||/ ||||/ ||"), 17);

getTallyCount("||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ |") should return 41.

assert.equal(getTallyCount("||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ ||||/ |"), 41);

--seed--

--seed-contents--

function getTallyCount(str) {

  return str;
}

--solutions--

function getTallyCount(str) {
  return str.replace(/ /g, "").length;
}