Javascript easy solution. O(n)
\n// Save vowels in a set\nconst VOWELS = new Set([\'a\', \'e\', \'i\', \'o\', \'u\']);\n\n/**\n * @param {string} word\n * @return {number}\n */\nconst countVo
```\n// Save vowels in a set\nconst VOWELS = new Set([\'a\', \'e\', \'i\', \'o\', \'u\']);\n\n/**\n * @param {string} word\n * @return {number}\n */\nconst countVowels = function(word) {\n  let count = 0;\n\n  const length = word.length;\n  // Return diretly if the word is empty\n   if (!length) {\n     return count;\n   }\n\n   \n   for (let i = 0; i < length; i += 1) {\n\t // Continue if current letter is not a vowel\n     if (!VOWELS.has(word[i])) {\n       continue;\n     }\n\n     const left = i;\n     const right = length - 1 - i;\n\t // Otherwise calculate how many substrings it appears in and add the number to the count\n     count += length + left * right;\n   }\n\n   return count;\n};\n```
['JavaScript']