代码
#include <iostream>
using namespace std;
const int LEN = 5;
int main() {
int n;
cin>>n;
string s;
getline(cin, s);
for(int i=0; i<n; i++){
string str;
getline(cin, str);
string tmp = "aeiou";
int count[LEN] = {0};
for(int j=0; j<str.length(); j++){
for(int k=0; k<LEN; k++){
if(str.at(j)==tmp.at(k)){
count[k]++;
}
}
}
if(i>0){
cout<<endl;
}
for(int k=0; k<LEN; k++){
cout<<tmp.at(k)<<":"<<count[k]<<endl;
}
}
return 0;
}
注解
1、水题。
2、元音数组。
3、多个测试实例之间有空行,结尾无多余空行。