#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;

bool wildcardMatch(string &s1, string& pat, int i, int j) {
  if (i == s1.size()) return j == pat.size();
  char c1 = s1[i];
  char c2 = pat[j];
  if (c2 != '*' && c1 != c2) return false;
  else
    return wildcardMatch(s1,pat,i+1,j+1) || wildcardMatch(s1,pat,i+1,j);
}

int main() {
  string s1 = "readme.txt";
  string pat = "*.txt";
  bool result = wildcardMatch(s1,pat,0,0);
  cout << "matched?:" << result << endl;
  return 0;
}