mirror of
https://github.com/lWolvesl/leetcode.git
synced 2026-02-27 20:08:07 +08:00
23 lines
468 B
C++
23 lines
468 B
C++
#include <string>
|
|
|
|
class Solution {
|
|
public:
|
|
int vowelConsonantScore(std::string s) {
|
|
int v =0,c=0;
|
|
std::string col = "aeiou";
|
|
for (auto i : s) {
|
|
if (i > 122 || i < 97) {
|
|
continue;
|
|
}
|
|
if (col.find(i) != std::string::npos) {
|
|
v++;
|
|
}else {
|
|
c++;
|
|
}
|
|
}
|
|
if (c==0) {
|
|
return 0;
|
|
}
|
|
return v/c;
|
|
}
|
|
}; |