Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
118136 冯诚阳 输出元音字母 C++ Accepted 1 MS 272 KB 695 2025-04-24 18:51:59

Tests(1/1):


Code:

#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; }