Java solution
Note: I wasted lot of time on this via brute force but couldn\'t come up with right solution (mine was timing out). \nBelow is from one of submission (not mine)
Note: I wasted lot of time on this via brute force but couldn\'t come up with right solution (mine was timing out). \nBelow is from one of submission (not mine), sharing with others here.\n\n```\n   public long countVowels(String word) {\n        \n        long ans = 0; //focus on long (return type)\n        long size = word.length();\n        \n        for(long i=0; i<size; i++) {\n            char ch = word.charAt((int) i);\n            \n            if(ch == \'a\' || ch == \'e\' || ch == \'i\' || ch == \'o\' || ch == \'u\') {\n                \n                ans += (i+1)*(size-i); //magical line\n            }\n        }\n        \n        return ans;\n\t\t}
['Java']