Created
May 3, 2019 14:02
-
-
Save godtaehee/8e65fdf9c2a255ad940bc8d4592219ce to your computer and use it in GitHub Desktop.
#1152
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
using namespace std; | |
int main(){ | |
char line[1000000]; | |
int count = 0; | |
cin.getline(line, 1000000, '\n'); | |
int size = strlen(line); | |
for(int i = 0; i < size; i++){ | |
if(line[i] != ' ' && line[i+1] == ' ') | |
count++; | |
else if(line[i] != ' ' && line[i+1] == '\0') | |
count++; | |
} | |
cout << count; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment