Easy Java Solution O(n) with Expalanation
Number of susbstrings in which the vowel at word.charAt(i) will occur will be its own substrings i.e. len-i and in the substrings of previous elements .Number o
Number of susbstrings in which the vowel at **word.charAt(i)** will occur will be its own substrings i.e. **len-i** and in the substrings of **previous** elements .Number of elements  before it will be **i** and **(len-i)** will be the susbtrings in which it will occur.\n```\nclass Solution {\n    public long countVowels(String word) {\n        long ans=0;\n        String vowels="aeiou";\n        int len=word.length();\n        for (int i=0;i<word.length();i++)\n        {\n            char ch=word.charAt(i);\n            if (ch==\'a\'|| ch==\'e\'||ch==\'i\'||ch==\'o\'||ch==\'u\')\n            {\n                ans+=len-i+(long)(i)*(len-i);\n            }\n        }\n        return ans;\n    }\n}\n```
['Math', 'String', 'Java']