[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]:
dx = integer array of size 4 with dx = {0, 0, -1, 1}
dy = integer array of size 4 with dy = {1, -1, 0, 0}
define the main function
    n = integer
    read n
    s = vector of string
    c = character
    tmp = string
    for i = 0 to n exclusive
        read tmp
        append tmp in s
        transform(s[i].begin(), s[i].end(), s[i].begin(), tolower)
    end of the block
    shit, fuck = string
    read shit, c
    save = string with save = shit
    fuck = shit
    transform(save.begin(), save.end(), save.begin(), tolower)
    rep = integer array of size [save.size()] = {}
    for i = 0 to n exclusive
        for j = 0 to shit.size() exclusive
            if (j + s[i].size() - 1 >= save.size()), continue next iteration
            if (save.substr(j, s[i].size()) is s[i])
                for k = 0 to s[i].size(), rep[k + j] = 1
        end of the block
    for i = 0 to shit.size() exclusive
        if (rep[i])
            if (save[i] is not c)
                shit[i] = c
            else
                if (c is a)
                    shit[i] = b
                else
                    shit[i] = a
            end of the block
            if (fuck[i] <= Z and fuck[i] >= A), shit[i] = (cast to character)toupper(shit[i])
        end of the block
    end of the block
    print shit
end of the block

[CODE]:

int dx[4] = {0, 0, -1, 1};
int dy[4] = {1, -1, 0, 0};
int main() {
    int n;
    cin >> n;
    vector<string> s;
    char c;
    string tmp;
    for (int i = 0; i < n; i += 1) {
        cin >> tmp;
        s.push_back(tmp);
        transform(s[i].begin(), s[i].end(), s[i].begin(), ::tolower);
    }
    string shit, fuck;
    cin >> shit >> c;
    string save = shit;
    fuck = shit;
    transform(save.begin(), save.end(), save.begin(), ::tolower);
    int rep[save.size()] = {};
    for (int i = 0; i < n; i += 1)
        for (int j = 0; j < shit.size(); j += 1) {
            if (j + s[i].size() - 1 >= save.size()) continue;
            if (save.substr(j, s[i].size()) == s[i])
                for (int k = 0; k < s[i].size(); k += 1) rep[k + j] = 1;
        }
    for (int i = 0; i < shit.size(); i += 1) {
        if (rep[i]) {
            if (save[i] != c)
                shit[i] = c;
            else {
                if (c == 'a')
                    shit[i] = 'b';
                else
                    shit[i] = 'a';
            }
            if (fuck[i] <= 'Z' && fuck[i] >= 'A') shit[i] = (char)toupper(shit[i]);
        }
    }
    cout << shit << '\n';
}