Notice
Recent Posts
문제 풀이 및 개발 공간
[백준] 1264번 모음의 개수 (bronze 4 - 자바 동일 문제 본문
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main()
{
unordered_map<char, int> dict;
dict.insert({'a', 1});
dict.insert({'e', 1});
dict.insert({'i', 1});
dict.insert({'o', 1});
dict.insert({'u', 1});
dict.insert({'A', 1});
dict.insert({'E', 1});
dict.insert({'I', 1});
dict.insert({'O', 1});
dict.insert({'U', 1});
while (true) {
string str;
getline(cin, str);
if (str == "#") {
break;
}
int answer = 0;
for (int i = 0; i < str.length(); i++) {
if (dict.find(str.at(i)) != dict.end()) {
answer++;
}
}
cout << answer << endl;
}
}
'백준공부 > cpp' 카테고리의 다른 글
[백준] 2754번 학점계산 (bronze 5 (0) | 2023.12.24 |
---|---|
[백준] 5533번 유니크 (bronze 1 (2) | 2023.12.21 |
[백준] 11727번 2xn 타일링 2 (silver 3 (0) | 2023.12.21 |
[백준] 2576번 홀수 (bronze 3 (0) | 2023.12.21 |
[백준] 15680번 연세대학교 (bronze 5 (0) | 2023.12.21 |