mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1226.c
This commit is contained in:
parent
8784cc2469
commit
ab1804f3b8
26
QUSTOJ/1226.c
Normal file
26
QUSTOJ/1226.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
char cmdline[10240];
|
||||
int main()
|
||||
{
|
||||
int line,word;
|
||||
scanf("%d%*c",&line);
|
||||
for(;line>0;line--)
|
||||
{
|
||||
memset(cmdline,0,10240);
|
||||
gets(cmdline);
|
||||
int i;
|
||||
int len=strlen(cmdline);
|
||||
word=0;
|
||||
for(i=1;i<len-1;i++)
|
||||
{
|
||||
if(cmdline[i]==' '&&cmdline[i-1]!=' '&&cmdline[i+1]!=' ')
|
||||
{
|
||||
word++;
|
||||
}
|
||||
}
|
||||
printf("%d\n",++word);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user