#include <cstdio>
#include <cstring>
const int LEN = 1000;
void prefix(char* mode, int* next) {
int j = -1, m = strlen(mode);
next[0] = -1;
for (int i=1; i<m; i++) {
while (j!=-1 && mode[j+1]!=mode[i]) j = next[j];
if (mode[j+1] == mode[i]) j++;
next[i] = j;
}
}
int kmp(char* main, char* mode) {
int n = strlen(main), m = strlen(mode), q = -1, ans = 0;
int next[LEN];
prefix(mode, next);
for (int i=0; i<n; i++) {
while (q>-1 && mode[q+1]!=main[i]) q = next[q];
if (mode[q+1] == main[i]) q++;
if (q == m-1) {
ans++;
q = next[q];
}
}
return ans;
}
int main() {
char a[1000], b[1000];
scanf("%s %s", a, b);
printf("%d\n", kmp(a, b)); //输出b在a中出现的次数
return 0;
}