#include <bits/stdc++.h>
using namespace std;
int C(int n, int r) {
  int res = 1;
  for (int i = 0; i < r; i++) {
    res *= (n - i);
  }
  int div = 1;
  for (int i = 2; i <= r; i++) {
    div *= i;
  }
  return (res / div);
}
int searchN(int k, int r) {
  int lo = r, hi = 100;
  while (lo < hi) {
    int mid = (lo + hi + 1) / 2;
    if (C(mid, r) > k) {
      hi = mid - 1;
    } else if (C(mid, r) < k) {
      lo = mid;
    } else {
      return mid;
    }
  }
  return lo;
}
int main() {
  int n;
  cin >> n;
  string s[n], w, w2;
  char special;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    transform(s[i].begin(), s[i].end(), s[i].begin(), ::tolower);
  }
  cin >> w >> special;
  vector<int> ans((int)w.length() + 1, 0);
  w2 = w;
  transform(w2.begin(), w2.end(), w2.begin(), ::tolower);
  for (int str = 0; str < n; str++) {
    for (int start = 0; start + (int)s[str].length() <= (int)w.length();
         start++) {
      if (s[str] == w2.substr(start, (int)s[str].length())) {
        ans[start]++;
        ans[start + s[str].length()]--;
      }
    }
  }
  for (int i = 1; i < (int)w.length(); i++) ans[i] += ans[i - 1];
  for (int i = 0; i < (int)w.length(); i++) {
    if (ans[i] > 0) {
      char ch = w[i];
      if (ch == special) {
        if (special == 'a') {
          w[i] = 'b';
        } else {
          w[i] = 'a';
        }
      } else if (ch == char('A' + (special - 'a'))) {
        if (special == 'a') {
          w[i] = 'B';
        } else {
          w[i] = 'A';
        }
      } else {
        if (ch < int('a')) {
          w[i] = char('A' + (special - 'a'));
        } else {
          w[i] = special;
        }
      }
    }
  }
  cout << w << endl;
  return 0;
}
