Approach

simple problem, calcualte vowel and consonant and do division.

Code

class Solution {
public:
    int vowelConsonantScore(string s) {
        int v = 0;
        int con = 0;
        for(const char& c: s) {
            if(c < 'a' || c > 'z') continue;
            if(c == 'a' || c == 'e'  || c == 'i'  || c == 'o'  || c == 'u' ) ++v;
            else ++con;
        }
        return con == 0 ? 0 : v / con;
    }
};