#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

bool is_prefix(string main,string pre, int st = 0) {
    if (st >= main.length()) return pre.empty();
    if (pre.empty()) return true;
    if (main[st] != pre[0]) return false;
    return is_prefix(main, pre.substr(1), st + 1);
}
void solve() {
    cout << is_prefix("abcdefgh", "abcd")<<endl;
    cout << is_prefix("abcdefgh","")<<endl;
    cout << is_prefix("abcdefgh","abd")<<endl;
}

int main() {
    IOS;
    solve();
    return 0;
}