Run ID:118136
提交时间:2025-04-24 18:51:59
#include <iostream> #include <string> #include <cctype> // 用于tolower函数 using namespace std; // 提取元音字母函数 string extractVowels(const string &s) { string vowels; for (char c : s) { // 转换为小写方便判断 char lowerC = tolower(c); if (lowerC == 'a' || lowerC == 'e' || lowerC == 'i' || lowerC == 'o' || lowerC == 'u') { vowels += c; // 保留原始大小写 } } return vowels; } int main() { string input; getline(cin, input); // 读取可能包含空格的整行输入 string result = extractVowels(input); cout << result << endl; return 0; }