编辑代码

const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
  const words = (await readline()).split(" ");
  let count = 0;
  const hasNumber = /[^a-z]/;
  // 正向检测
  const regExp1 = /[^aeiou][aeiou][^aeiour]e/;
  // 反向检测
  const regExp2 = /e[^aeiour][aeiou][^aeiou]/;
  words.forEach((word) => {
    // console.log(hasNumber.test(word));
    if (hasNumber.test(word)) {
      for (let i = 0; i < word.length - 3; i++) {
        const splice = word
          .split("")
          .slice(i, i + 4)
          .join("");
        console.log(splice);
        if (regExp1.test(splice)) count++;
      }
    } else {
      // console.log(true);
      for (let i = 0; i < word.length - 3; i++) {
        const splice = word
          .split("")
          .slice(i, i + 4)
          .join("");
        // console.log(splice);
        if (regExp2.test(splice)) count++;
      }
    }
  });
  console.log(count);
})();