분류 전체보기
-
10820) 문자열 분석 c++백준코딩일기 2020. 11. 24. 11:03
문제) www.acmicpc.net/problem/10820 10820번: 문자열 분석 문자열 N개가 주어진다. 이때, 문자열에 포함되어 있는 소문자, 대문자, 숫자, 공백의 개수를 구하는 프로그램을 작성하시오. 각 문자열은 알파벳 소문자, 대문자, 숫자, 공백으로만 이루어져 있 www.acmicpc.net 풀이 ) 1. 한 줄 씩 입력을 받음 2. arr 배열은 출력을 위해서 소문자, 대문자, 숫자, 빈공간 의 수 저장소이다. 매 입력때마다 0으로 초기화해줌 3. 만약 아무것도 입력이 들어오지 않으면 정지 4. 들어온 문장을 char 형으로 짤라서 비교후 배열에 하나씩 저장. 코드 ) #include using namespace std; string input; int main(void) { ios::..