View Code of Problem 58

#include<iostream>
#include<string.h>
using namespace std;
int main()
{   int n=0;
	string str;
	cin>>str;
    for(int i=0;i<str.length();i++)
      {
	    if(str[i]!=' '&&str[i+1]==' ')
        n++;
      }  
	cout<<n<<endl;
}

Double click to view unformatted code.


Back to problem 58