| #include <iostream> #include <string> | |
| using namespace std; | |
| int main() | |
| { | |
| string str; | |
| getline(cin, str, '\n'); | |
| int l=str.size(); | |
| int cnt=0; | |
| int cnt_w=0; | |
| bool chk=0; | |
| for(int i=0; i<l; i++) | |
| { | |
| if(str[i] !=' ' && !chk) | |
| { | |
| cnt++; | |
| chk=1; | |
| } | |
| else if(str[i]==' ') | |
| { | |
| chk=0; | |
| } | |
| } | |
| cout << cnt; | |
| } |
'알고리즘 문제 풀이 > 1DP_과제(~180615)' 카테고리의 다른 글
| 171123_1222_계산기1 (0) | 2017.11.23 |
|---|---|
| 171122_11654_아스키코드 (0) | 2017.11.22 |
| 171122_1949_등산로 조성 (0) | 2017.11.22 |
| 171121_1218_괄호 짝짓기 (0) | 2017.11.22 |
| 171121_1211_Ladder2 (0) | 2017.11.21 |