VioletaBabel

10820번: 문자열 분석 본문

백준/백준-C++
10820번: 문자열 분석
Beabletoet 2017. 6. 6. 00:21

#include<cstdio>

#include<iostream>

#include<string>

using namespace std;

int main()

{

string text;

while (getline(cin, text))

{

int ans[4] = { 0,0,0,0 };

for (int i = 0; i < text.size(); ++i)

if (text[i] >= 'a' && text[i] <= 'z')

++ans[0];

else if (text[i] >= 'A' && text[i] <= 'Z')

++ans[1];

else if (text[i] >= '0' && text[i] <= '9')

++ans[2];

else

++ans[3];

printf("%d %d %d %d\n", ans[0], ans[1], ans[2], ans[3]);

}

}

'백준 > 백준-C++' 카테고리의 다른 글

10807번: 개수 세기  (0) 2017.06.06
10821번: 정수의 개수  (0) 2017.06.06
12813번: 이진수 연산  (0) 2017.06.06
1927번: 최소 힙  (0) 2017.06.05
1764번: 듣보잡  (0) 2017.06.05
Comments