View Code of Problem 58

#include<stdio.h>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
      char s[10000];
      gets(s);
      int i=0,count=0;
      while(s[i]!= '\0'){
      	 if((s[i]==' ')&&(s[i+1]!=' '))
      	 count++;
      	 i++;
	  }
	  printf("%d\n",count);
       
	  return 0;
}

Double click to view unformatted code.


Back to problem 58