피너클의 it공부방
백준 1264 모음의 개수 (c++) : 피너클 본문
728x90
반응형
https://www.acmicpc.net/problem/1264
1264번: 모음의 개수
입력은 여러 개의 테스트 케이스로 이루어져 있으며, 각 줄마다 영어 대소문자, ',', '.', '!', '?', 공백으로 이루어진 문장이 주어진다. 각 줄은 최대 255글자로 이루어져 있다. 입력의 끝에는 한 줄
www.acmicpc.net
간단한 구현문제다.
#include <iostream>
#include <string>
using namespace std;
char c[] = { 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U' };
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int a;
string s;
while (true) {
a = 0;
getline(cin, s);
if (s == "#") break;
for (int i = 0; i < s.length(); i++) {
for (int j = 0; j < 10; j++) {
if (s[i] == c[j]) {
a++;
break;
}
}
}
cout << a << endl;
}
}
전체코드다.
728x90
반응형
'백준' 카테고리의 다른 글
백준 10807 개수 세기 (c++) : 피너클 (0) | 2022.06.07 |
---|---|
백준 11948 과목선택 (c++) : 피너클 (0) | 2022.06.06 |
백준 10768 특별한 날 (c++) : 피너클 (0) | 2022.06.04 |
백준 10101 삼각형 외우기 (c++) : 피너클 (0) | 2022.06.03 |
백준 4299 AFC 윔블던 (c++) : 피너클 (1) | 2022.06.02 |
Comments