Run ID:114090

提交时间:2025-03-19 23:19:15

#include <iostream> #include <string> using namespace std; // 函数:提取字符串中的元音字母 string extractVowels(const string& input) { string vowels = "aeiouAEIOU"; // 包含所有元音字母 string result = ""; // 用于存储提取的元音字母 // 遍历输入字符串 for (char ch : input) { // 如果字符是元音字母,则添加到结果字符串中 if (vowels.find(ch) != string::npos) { result += ch; } } return result; } int main() { string input; // 读取输入字符串(包含空格) getline(cin, input); // 调用函数提取元音字母 string output = extractVowels(input); // 输出结果 cout << output << endl; return 0; }