Skip to content

Commit

Permalink
단어의 개수
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongopo committed Feb 2, 2021
1 parent 32418fb commit da1e384
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions code1152.cpp
@@ -0,0 +1,27 @@
#include <iostream>
#include <string>
using namespace std;

int main() {
string array;
int i=0;
int count=0;
int change=0;
getline(cin,array);
for (i = 0; i < array.length(); i++) {
if (array[i] == ' ') {
if (change == 1) {
change = 0;
}
}
else {
if (change == 0) {
change = 1;
count++;
}
}
}

std::cout << count;
return 0;
}

0 comments on commit da1e384

Please sign in to comment.