#include <iostream>
using namespace std;

int main() {
    string s, t;

    cin >> s >> t;

    string x = t;
    int ans = 0;
    for (int i = 0; x.size() <= s.size(); i++) {
        // check
        // cerr << "x: " << x << endl;
        int idx = 0;
        for (char ch : s) {
            if (idx < x.size() and ch == x[idx]) {
                idx++;
            }
        }
        if (idx != x.size()) break;

        ans++;

        long long size = x.size() * (t.size() + 1) + t.size();
        if (size > s.size()) break;

        string y = x;
        for (char ch : t) {
            y.push_back(ch);
            y += x;
        }
        x = y;
    }

    cout << ans << endl;

    return 0;
}
