function buildCharacterMap(str) {
  const charMap = {}

  for (let char of cleanStr(str)) {
    charMap[char] = charMap[char] + 1 || 1
  }

  return charMap
}
// Helper function to build character map
Helper function to build character map
Helper function to build character map
function buildCharacterMap(str) {
  const charMap = {}
  for (let char of cleanStr(str)) {
    charMap[char] = charMap[char] + 1 || 1
  }
  return charMap
}
function buildCharacterMap ( str ) { const charMap = { } for ( let char of cleanStr ( str ) ) { charMap [ char ] = charMap [ char ] + 1 || 1 } return charMap }
Helper function to build character map
Helper function to build character map