#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000")
const long double LDINF = 9128739847123.00;
const long double eps = 1e-9;
const int INF = 1 << 30;
const long double pi = fabsl(atan2(0.0, -1.0));
using namespace std;
int n;
string s[1110], w;
char let;
void Load() {
  cin >> n;
  int i;
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  cin >> w;
  cin >> let;
  let = tolower(let);
}
int dp[1110], pr[1110];
bool tochange[310];
int f(int i) {
  if (i == w.size()) return 0;
  if (dp[i] != -1) return dp[i];
  dp[i] = -2;
  if (tochange[i]) {
    int from = 'a';
    if (w[i] >= 'A' && w[i] <= 'Z') from = 'A';
    for (int j = from; j < from + 26; j++) {
      if (tolower(j) == tolower(w[i])) continue;
      int t = (tolower(j) == let) ? 1 : 0;
      if (dp[i] < f(i + 1) + t) {
        dp[i] = f(i + 1) + t;
        pr[i] = j;
      }
    }
  } else {
    dp[i] = f(i + 1);
    pr[i] = w[i];
  }
  return dp[i];
}
void out(int i) {
  if (i == w.size()) return;
  printf("%c", pr[i]);
  out(i + 1);
}
void Solve() {
  memset(dp, -1, sizeof dp);
  string pp = w;
  for (int i = 0; i < w.size(); i++) pp[i] = tolower(pp[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s[i].size(); j++) s[i][j] = tolower(s[i][j]);
    int t = 0;
    while ((t = pp.find(s[i], t)) != -1) {
      for (int j = 0; j < s[i].size(); j++) tochange[t + j] = true;
      t++;
    }
  }
  f(0);
  out(0);
}
int main() {
  Load();
  Solve();
  return 0;
}
