본문 바로가기
알고리즘/구름

[ 구름 / 문자열 ] 앵무새 꼬꼬

by 뎁꼼 2020. 6. 28.

1. 문제


https://level.goorm.io/exam/49053/%EC%95%B5%EB%AC%B4%EC%83%88-%EA%BC%AC%EA%BC%AC/quiz/1

 

구름LEVEL

코딩테스트에서 가장 높은 비중을 차지하는 알고리즘 문제를 제작하고 풀이할 수 있는 온라인 저지 서비스입니다. 기업에서 선호하는 C, C++, 파이썬(Python), 자바(Java), 자바스크립트(Javascript) 이��

level.goorm.io

2. 소스코드


#include <iostream>
#include <string>
#define MAX 5
using namespace std;

char LUT[MAX] = {'a','e','i','o','u'};
int n;
string str;
int main() {
 	cin >> n;
	getline(cin, str);
	while (n--){
		getline(cin, str);
		string ans = "";
		
		for(char ch : str){
	    char temp_ch = tolower(ch);
			if(temp_ch == 'a' or temp_ch == 'e' or temp_ch == 'i' or temp_ch == 'o' or temp_ch == 'u'){
				ans += ch;
			}
		}
		
		if(ans.length() == 0) cout << "???" <<'\n';
		else cout << ans << '\n';
	}
	
	return 0;
}