text: const { NotImplementedError } = require("../extensions/index.js");
  
  /**
   * Given matrix where you have to find cats by ears "^^"
   *
   * @param {Array<Array>} matrix
   * @return {Number} count of cats found
   *
   * @example
   * countCats([
   *  [0, 1, '^^'],
   *  [0, '^^', 2],
   *  ['^^', 1, 2]
   * ]) => 3`
   *
   */
  function countCats(matrix) {
    let counter = 0;
    if (matrix == undefined || matrix.length == 0) {
      return counter;
    } else {
      for (let i = 0; i < matrix.length; i++) {
        while (matrix[i].indexOf("^^") != -1) {
          matrix[i][matrix[i].indexOf("^^")] = null;
          counter++;
        }
      }
      return counter;
    }
  }
  
  module.exports = {
    countCats,
  };
  