B - 罠 / AtCoderBeginnerContest #002

abc002.contest.atcoder.jp

#include <iostream>
#include <string>
using namespace std;

void Solve(string w)	{
	string answer="";
	const char vowel[5]={'a', 'i', 'u', 'e', 'o'};

	for (int i=0; i<w.length(); ++i)	{
		bool flg=true;
		for (int j=0; j<5; ++j)
			if (w[i] == vowel[j])	{
				flg=false;
				break;
			}
		if (flg)	answer+=w[i];
	}
	cout << answer << endl;
}

int main(void)	{
	string w;

	cin >> w;
	Solve(w);
	return 0;
}

母音ではない文字を違う変数に入れ、最後に出力。
~了~