View Code of Problem 58

#include <iostream>
#include <string.h>
using namespace std;

int main(){
    char str[1000];
    int count = 0,flag = 0;
    gets(str);
    int len = strlen(str);
    for(int j=0;j<len;j++){
        if(isalpha(str[j]))
            flag=1;
        else{
            if(flag==1){
                count ++;
                flag = 0;
            }
        }
    }
    printf("%d",count);
    return 0;
}

Double click to view unformatted code.


Back to problem 58