C++ o(n) simple solution using concept of Arithmetic Progression
\tclass Solution {\n\tpublic:\n\t\tlong long a, res;\n\t\tlong long count(long long &a, long long &n){\n\t\t\treturn (n(2a+(n-1)*-2))/2;\n\t\t}\n\t\tlong long c
\tclass Solution {\n\tpublic:\n\t\tlong long a, res;\n\t\tlong long count(long long &a, long long &n){\n\t\t\treturn (n*(2*a+(n-1)*-2))/2;\n\t\t}\n\t\tlong long countVowels(string &word) {\n\t\t\tres = 0;\n\t\t\ta=word.size();\n\t\t\tfor(long long i=1; i<=word.size(); i++){\n\t\t\t\tif(word[i-1] == \'a\' || word[i-1] == \'e\' || word[i-1] == \'i\' || word[i-1] == \'o\' || word[i-1] == \'u\')\n\t\t\t\t\tres += count(a, i);\n\t\t\t}\n\t\t\treturn res;\n\t\t}\n\t};
[]