text: function binarySearch(arr, elem) {
    let left = 0;
    let right = arr.length - 1;
    let mid = Math.floor((left + right) / 2);
  
    while (arr[mid] !== elem && left <= right) {
      if (elem < arr[mid]) right = mid - 1;
      else left = mid + 1;
      mid = Math.floor((left + right) / 2);
    }
    return arr[mid] === elem ? mid : -1;
  }
  
  function naiveStringSearch(long, short) {
    let count = 0;
    for (let i = 0; i < long.length; i++) {
      for (let j = 0; j < short.length; j++) {
        if (short[j] !== long[i + j]) break;
        if (j === short.length - 1) count++;
      }
    }
    return count;
  }
  