Run ID:114520

提交时间:2025-03-22 14:36:36

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