#include<stdio.h>
int ste_d(char *a,char *b);
int main()
{
int sum,n;
while(scanf("%d",&n)!=EOF)
{
while(n>0)
{
fflush(stdin);
char a[100],b[10]="welcome";
gets(a);
fflush(stdin);
sum=ste_d(a,b);
printf("%d\n",sum);
n--;
}
}
return 0;
}
int ste_d(char *a,char *b)
{
int s=0;
char *temp;
while(*a!='\0')
{
if(*b==*a)
{
temp = b;
for(;*temp!='\0'&&*a!='\0';a++,temp++)
{
if(*temp!=*a)
break;
}
if(*temp=='\0' && (*a==' '||*a=='\0'))
{
s++;
}
continue;
}
a++;
}
return s;
}