#include <iostream>
#include <string>
using namespace std;
#define MAXN 1000010
int n[MAXN];
void getNext(string p) { //p从位置1开始存储
int i = 1, j = 0;
n[1] = 0;
while (i < p.size()) {
if (j == 0 || p[i] == p[j]) {
i++;
j++;
n[i] = j;
}
else
j = n[j];
}
}
int kmp(string t, string p) { //t, p都从位置1开始存储
int i = 1, j = 1, count = 0;
while (i < t.size()) {
while (i < t.size() && j < p.size()) {
if (j == 0 || t[i] == p[j]) {
i++;
j++;
}
else {
j = n[j];
}
}
if (j == p.size()) {
count++;
j = n[j];
}
}
return count;
}
int main() {
string t, p;
while (cin >> t >> p) {
getNext(" " + p);
int count = kmp(" " + t, " " + p);
cout << count << endl;
}
}