#include #include using namespace std;

int main() { string s; cin >> s; int len = s.size(); int cnt = 0, ans = 0; for (int i = 0; i < len; i++) { if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') { cnt++; ans = max(ans, cnt); } else { cnt = 0; } } cout << ans << endl; return 0; }

C++ 查找字符串中最长连续元音序列长度

原文地址: https://www.cveoy.top/t/topic/m5Yh 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录