View Code of Problem 58

#include<iostream> 
#include <stdio.h>
#include <math.h>
#include "string.h"
using namespace std;
int main(){
	char a[100];
	gets(a);
	int flag=1;
	int x=strlen(a);
	int sum=0;
	for(int i=0;i<x;i++){
		if(a[i]>='a'&&a[i]<='z'||a[i]>='A'&&a[i]<='Z'){
			if(flag==1){
				sum=sum+1;
				flag=0;
			}
		}else{
			flag=1;
		}
	}
	cout<<sum;	
	return 0;
}

Double click to view unformatted code.


Back to problem 58