View Code of Problem 58

#include <string.h>
void main() 
{
	char str1[1000], str2[1000];
	gets(str1);
	int k = 0;
	for (int i = 0; i < strlen(str1); i++)
	{
		if (str1[i] >= 'a' && str1[i] <= 'z' || str1[i] >= 'A' && str1[i] <= 'Z')
		{
			while (str1[i] != ' ')
			{
				i++;
			}
			k++;
		}
	}
	printf("%d", k);
}

Double click to view unformatted code.


Back to problem 58