#include
#include
int main()
{
char ch[20];//This string has at most 99 characters and one character for '\0'.
int i=0;//Initialization.
int j;
printf("Please input a line of sentence: \n");//Input the string.
do
{
scanf("%s",ch);
}
while(strcmp(ch,"End")!='\0');
if((ch[0]>='a'&&ch[0]<='z')||(ch[0]>='A'&&ch[0]<='Z'))//If the first character is a letter, then intialize j=1.
{
j=1;
}
else//If the first character is not a letter, then intialize j=0.
{
j=0;
}
for(i=1;i<100;i++)
{
if(((ch[i]>='a'&&ch[i]<='z')||(ch[i]>='A'&&ch[i]<='Z'))&&(ch[i-1]==' '))//If the ith character is a letter and the previous one is a space.
{
j++;//Then the number of the English words plus one.
}
if(ch[i-1]=='E'&&ch[i]=='n'&&ch[i+1]=='d')
{
j=j-1;
}
}
printf("the output is:%d",j);//Output the result: the number of English words in a sentence.
return 0;
}