Python | Combinatrics | Math
Consider string "xxax"\n1. vowel can be part of substrings a, xa, xxa in left hand side of vowel\n2. vowel can be part of substrings  a, ax  in right hand side 
Consider string "xxax"\n1. vowel can be part of substrings a, xa, xxa in left hand side of vowel\n2. vowel can be part of substrings  a, ax  in right hand side of vowel\n3. Then simply we need to multiple l*r (a, xa, xxa) * (a, ax) => (aa, aax, xaa, xaax, xxaa, xxaax) **duplicates "aa" => "a"  **\n```\nclass Solution(object):\n    def countVowels(self, word):\n        """\n        :type word: str\n        :rtype: int\n        """\n        vm = {\'a\': 1, \'e\': 1, \'i\': 1, \'o\': 1, \'u\': 1}\n        c = 0\n        for k, w in enumerate(word):\n            if w in vm:\n                r = len(word) - k # Calculate no of substrings formed in right side with vowel as pivot\n                l = (k+1) # In left hand side\n                c+=r*l # This for finding total no of strings crossing pivots\n        return c\n```
['Combinatorics', 'Python']