const buildCharCounts = str => [...str].reduce((counts, ch) => {
    counts[ch] = counts[ch] + 1 || 1;
    return counts;
  }, {});