[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
MAXN = const integer with MAXN = 1e6 + 10
INF = const integer with INF = 1e9 + 7
res, a, ans = strings with a = array of size 110
lt = character
isU, vis = bool array of size 110
define the main function
    n = integer
    read n
    for i = 0 to n exclusive
        read a[i]
        for j = 0 to a[i].length() exclusive
            if (isupper(a[i][j])), a[i][j] = a[i][j] - A - a
    end of the block
    read res
    ans = res
    for i = 0 to res.length() exclusive
        if (isupper(res[i]))
            res[i] = res[i] - A - a
            isU[i] = 1
        end of the block
    read lt
    for i = 0 to res.length() exclusive
        for j = 0 to n exclusive
            if (res[i] =is a[j][0])
                k = integer
                for k = 0 to a[j].length() exclusive
                    if (res[i + k] is not a[j][k]), break loop
                if (k is a[j].length())
                    for k = 0 to a[j].length() exclusive
                        if (vis[i + k]), continue next iteration
                        if (res[i + k] is not lt)
                            ans[i + k] = if isU[i + k], lt - a + A else lt
                        else
                            for L = a to z
                                if (res[i + k] is not L)
                                    ans[i + k] = if isU[i + k], L - a + A else L
                                    break loop
                                end of the block
                        vis[i + k] = 1
                    end of the block
            end of the block
    print ans
    return to indicate successful execution
end of the block

[CODE]:

const int MAXN = 1e6 + 10;
const int INF = 1e9 + 7;
string res, a[110], ans;
char lt;
bool isU[110], vis[110];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        for (int j = 0; j < a[i].length(); j++)
            if (isupper(a[i][j])) a[i][j] -= 'A' - 'a';
    }
    cin >> res;
    ans = res;
    for (int i = 0; i < res.length(); i++)
        if (isupper(res[i])) {
            res[i] -= 'A' - 'a';
            isU[i] = 1;
        }
    cin >> lt;
    for (int i = 0; i < res.length(); i++)
        for (int j = 0; j < n; j++)
            if (res[i] == a[j][0]) {
                int k;
                for (k = 0; k < a[j].length(); k++)
                    if (res[i + k] != a[j][k]) break;
                if (k == a[j].length())
                    for (k = 0; k < a[j].length(); k++) {
                        if (vis[i + k]) continue;
                        if (res[i + k] != lt)
                            ans[i + k] = isU[i + k] ? lt - 'a' + 'A' : lt;
                        else
                            for (int L = 'a'; L <= 'z'; L++)
                                if (res[i + k] != L) {
                                    ans[i + k] = isU[i + k] ? L - 'a' + 'A' : L;
                                    break;
                                }
                        vis[i + k] = 1;
                    }
            }
    cout << ans << endl;
    return 0;
}