#include <bits/stdc++.h>
using namespace std;
int nA, nB, nVirus;
string A, B, virus;
int trans[101][26];
string prefix(string A, int len) {
  string ret;
  for (int i = 0; i < len; i++) ret += A[i];
  return ret;
}
bool endWith(string A, string pat) {
  if (A.length() < pat.length()) return false;
  for (int i = 0; i < pat.length(); i++)
    if (A[i - (int)pat.length() + (int)A.length()] != pat[i]) return false;
  return true;
}
int getStateID(string s) {
  int ret = 0;
  for (int i = 1; i <= nVirus; i++)
    if (endWith(s, prefix(virus, i))) ret = i;
  return ret;
}
int F[101][101][101];
int nex1[101][101][101];
int nex2[101][101][101];
int nex3[101][101][101];
string nex0[101][101][101];
int done[101][101][101];
int f(int pA, int pB, int state) {
  if (state == nVirus) return -10000;
  if (pA == nA && pB == nB) return 0;
  if (done[pA][pB][state]) return F[pA][pB][state];
  int &ret = F[pA][pB][state];
  ret = -10000;
  done[pA][pB][state] = true;
  if (pA != nA) {
    int v = f(pA + 1, pB, state);
    if (v > ret) {
      ret = v;
      nex1[pA][pB][state] = pA + 1;
      nex2[pA][pB][state] = pB;
      nex3[pA][pB][state] = state;
      nex0[pA][pB][state] = "";
    }
  }
  if (pB != nB) {
    int v = f(pA, pB + 1, state);
    if (v > ret) {
      ret = v;
      nex1[pA][pB][state] = pA;
      nex2[pA][pB][state] = pB + 1;
      nex3[pA][pB][state] = state;
      nex0[pA][pB][state] = "";
    }
  }
  if (pA != nA && pB != nB && A[pA] == B[pB]) {
    int v = 1 + f(pA + 1, pB + 1, trans[state][A[pA] - 'A']);
    if (v > ret) {
      ret = v;
      nex1[pA][pB][state] = pA + 1;
      nex2[pA][pB][state] = pB + 1;
      nex3[pA][pB][state] = trans[state][A[pA] - 'A'];
      nex0[pA][pB][state] = A[pA];
    }
  }
  return ret;
}
int MAIN() {
  cin >> A >> B >> virus;
  nA = A.length();
  nB = B.length();
  nVirus = virus.length();
  memset(nex1, 0xff, sizeof(nex1));
  for (int i = 0; i < nVirus; i++)
    for (int j = 0; j < 26; j++)
      trans[i][j] = getStateID(prefix(virus, i) + char('A' + j));
  memset(done, 0, sizeof(done));
  int ans = f(0, 0, 0);
  if (ans == 0)
    cout << ans << endl;
  else {
    int arg1 = 0;
    int arg2 = 0;
    int arg3 = 0;
    string ansString;
    while (nex1[arg1][arg2][arg3] != -1) {
      ansString += nex0[arg1][arg2][arg3];
      int nextArg1 = nex1[arg1][arg2][arg3];
      int nextArg2 = nex2[arg1][arg2][arg3];
      int nextArg3 = nex3[arg1][arg2][arg3];
      arg1 = nextArg1;
      arg2 = nextArg2;
      arg3 = nextArg3;
    }
    cout << ansString << endl;
  }
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  return MAIN();
}

### Prompt

In cpp, your task is to solve the following problem:

In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDEF. A substring of a string is a continuous subsequence of the string. For example, BCD is a substring of ABCDEF.

You are given two strings s1, s2 and another string called virus. Your task is to find the longest common subsequence of s1 and s2, such that it doesn't contain virus as a substring.

Input

The input contains three strings in three separate lines: s1, s2 and virus (1 ≤ |s1|, |s2|, |virus| ≤ 100). Each string consists only of uppercase English letters.

Output

Output the longest common subsequence of s1 and s2 without virus as a substring. If there are multiple answers, any of them will be accepted. 

If there is no valid common subsequence, output 0.

Examples

Input

AJKEQSLOBSROFGZ
OVGURWZLWVLUXTH
OZ


Output

ORZ


Input

AA
A
A


Output

0

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int nA, nB, nVirus;
string A, B, virus;
int trans[101][26];
string prefix(string A, int len) {
  string ret;
  for (int i = 0; i < len; i++) ret += A[i];
  return ret;
}
bool endWith(string A, string pat) {
  if (A.length() < pat.length()) return false;
  for (int i = 0; i < pat.length(); i++)
    if (A[i - (int)pat.length() + (int)A.length()] != pat[i]) return false;
  return true;
}
int getStateID(string s) {
  int ret = 0;
  for (int i = 1; i <= nVirus; i++)
    if (endWith(s, prefix(virus, i))) ret = i;
  return ret;
}
int F[101][101][101];
int nex1[101][101][101];
int nex2[101][101][101];
int nex3[101][101][101];
string nex0[101][101][101];
int done[101][101][101];
int f(int pA, int pB, int state) {
  if (state == nVirus) return -10000;
  if (pA == nA && pB == nB) return 0;
  if (done[pA][pB][state]) return F[pA][pB][state];
  int &ret = F[pA][pB][state];
  ret = -10000;
  done[pA][pB][state] = true;
  if (pA != nA) {
    int v = f(pA + 1, pB, state);
    if (v > ret) {
      ret = v;
      nex1[pA][pB][state] = pA + 1;
      nex2[pA][pB][state] = pB;
      nex3[pA][pB][state] = state;
      nex0[pA][pB][state] = "";
    }
  }
  if (pB != nB) {
    int v = f(pA, pB + 1, state);
    if (v > ret) {
      ret = v;
      nex1[pA][pB][state] = pA;
      nex2[pA][pB][state] = pB + 1;
      nex3[pA][pB][state] = state;
      nex0[pA][pB][state] = "";
    }
  }
  if (pA != nA && pB != nB && A[pA] == B[pB]) {
    int v = 1 + f(pA + 1, pB + 1, trans[state][A[pA] - 'A']);
    if (v > ret) {
      ret = v;
      nex1[pA][pB][state] = pA + 1;
      nex2[pA][pB][state] = pB + 1;
      nex3[pA][pB][state] = trans[state][A[pA] - 'A'];
      nex0[pA][pB][state] = A[pA];
    }
  }
  return ret;
}
int MAIN() {
  cin >> A >> B >> virus;
  nA = A.length();
  nB = B.length();
  nVirus = virus.length();
  memset(nex1, 0xff, sizeof(nex1));
  for (int i = 0; i < nVirus; i++)
    for (int j = 0; j < 26; j++)
      trans[i][j] = getStateID(prefix(virus, i) + char('A' + j));
  memset(done, 0, sizeof(done));
  int ans = f(0, 0, 0);
  if (ans == 0)
    cout << ans << endl;
  else {
    int arg1 = 0;
    int arg2 = 0;
    int arg3 = 0;
    string ansString;
    while (nex1[arg1][arg2][arg3] != -1) {
      ansString += nex0[arg1][arg2][arg3];
      int nextArg1 = nex1[arg1][arg2][arg3];
      int nextArg2 = nex2[arg1][arg2][arg3];
      int nextArg3 = nex3[arg1][arg2][arg3];
      arg1 = nextArg1;
      arg2 = nextArg2;
      arg3 = nextArg3;
    }
    cout << ansString << endl;
  }
  return 0;
}
int main() {
  ios ::sync_with_stdio(false);
  cout << fixed << setprecision(16);
  return MAIN();
}

```