Notice
Recent Posts
Recent Comments
Link
250x250
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Archives
Today
Total
관리 메뉴

피너클의 it공부방

백준 1264 모음의 개수 (c++) : 피너클 본문

백준

백준 1264 모음의 개수 (c++) : 피너클

피너클 2022. 6. 5. 13:47
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
반응형
Comments