为什么这个程序不能统计输入2行英文中包括多少个单词

#include <stdio.h>
#include <string.h>
int main()
{
    char c, str1[81], str2[81];
    int i, word = 0;
    /********** Begin *********/
    c=' ';
    gets(str1);gets(str2);
    i=0;
    while(str1[i]!='\0')
        if(str1[i]==c)word++;
        i++;
    i=0;
    while(str2[i]!='\0')
        if(str2[i]==c)word++;
        i++;

            // 请在此处添加你的代码
    /********** End **********/
    
    printf( "总共有%d个单词", word + 2 );
    
    return 0;

while的地方没有写大括号(没有把i++写在循环之内), 导致死循环。

    i=0;
    while(str1[i]!='\0') {
        if(str1[i]==c)word++;
        i++;
    }
    i=0;
    while(str2[i]!='\0') {
        if(str2[i]==c)word++;
        i++;
    }