/C06003 - Đếm số từ trong xâu

<Problem>

https://code.ptit.edu.vn/student/question/C06003
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main() {
	int t;
	scanf("%d", &t);
	getchar();

	while (t--) {
		char s[201];
		gets(s);

		int l = strlen(s);
		int cnt = 1;

		for (int i = 0; i < l - 1; i++) {
			if (s[i] == ' ' && s[i + 1] != ' ') cnt++;
		}

		printf("%d", cnt);

		printf("\n");

	}

	return 0;
}