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) {
    let count = 1;
    let encodeStr = '';
  
    for (let i = 0; i < str.length; i++) {
      if (str[i + 1] !== str[i]) {
        if (count > 1) {
          encodeStr += String(count) + str[i];
        } else {
          encodeStr += str[i];
        }
        count = 1;
      } else {
        count += 1;
      }
    }
  
    return encodeStr;
  }
  