View Code of Problem 58

#include "stdio.h"
void main(){
    char s[1000];
    int count = 0;
    int flag = 1;
    gets(s);
    for (int i = 0; s[i] != '\0'; ++i) {
        if ( (s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z')){
            if(flag){
                count++;
                flag = 0;
            }

        } else{
            if (flag == 0){
                flag = 1;
            }
        }

    }
    printf("%d",count);
}

Double click to view unformatted code.


Back to problem 58