//优秀代码 c++
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s1,s2;
int n;
cin>>n;
while(n--)
{
cin>>s1>>s2;
unsigned int m=s2.find(s1,0);
int num=0;
while(m!=string::npos)
{
num++;
m=s2.find(s1,m+1);
}
cout<<num<<endl;
}
}
//v1.0 C better
#include <stdio.h>
#include <string.h>
int main(){
char nd[10]={0};
char hys[1000]={0};
int num;
scanf("%d",&num);
getchar();
int i=0;
for(i=0;i<num;i++){
scanf("%s",nd);
getchar();
scanf("%s",hys);
getchar();
char *ph = hys;
int sum=0;
char *pn = strstr(ph,nd);
while(pn != NULL){
++sum;
char *tmp=++pn;
pn = strstr(tmp,nd);
}
printf("%d
", sum);
}
return 0;
}