Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Created January 21, 2014 08:38
Show Gist options
  • Save KT-Yeh/8536361 to your computer and use it in GitHub Desktop.
Save KT-Yeh/8536361 to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
char line[100000];
bool is_word (char a){
if (a<='z' && a>='a' || a<='Z' && a>='A')
return 1;
return 0;
}
int main()
{
// freopen ("input.txt","rt",stdin);
while (gets(line)){
int num;
num = is_word(line[0]);
for(int i=0; line[i+1]; i++){
if (!is_word(line[i])) num += is_word(line[i+1]);
}
printf("%d\n",num);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment