text: import { NotImplementedError } from "../extensions/index.js";
  
  /**
   * Given a string, return its encoding version.
   *
   * @param {String} str
   * @return {String}
   *
   * @example
   * For aabbbc should return 2a3bc
   *
   */
  export default function encodeLine(str) {
    const temp = str.split("");
    let res = "";
    for (let i = 0; i < temp.length; i++) {
      const char = temp[i];
      let count = 1;
      while (i + 1 < temp.length && char === temp[i + 1]) {
        count++;
        i++;
      }
      res += count === 1 ? char : `${count}${char}`;
    }
    return res;
  }
  