[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]:
fs = string vector
valid = long long integer array of size 200
define the main function
    n,in = long long integers
    read n
    h,w,k = strings
    ch = char
    for i=0 to n exclusive
        read h
        transform the string h to lowercase
        add h to end of fs
    end of the block
    read w and ch
    if ch - 'a' >=0 or 'z' - ch >=0
        set in = ch - 'a'
    else do the following
        set in= ch= 'A'
    end of the block
    set k = w
    transform w to lower case
    for i=0 to n exclusive
        create long long integer z = length of fs[i]
        for j=0 to length of w exclusive
            create a empty string temp
            for k=j to j+z exclusive set temp = temp + w[k]
            if temp is equal to fs [i]
                for k=j to j+z exclusive set valid[k]=1
        end of the block
    end of the block
    create empty string res
    for i=0 to length of w exclusive
        if valid[i] is not 0
            if k[i] >= 'a' and k[i] <= 'z'
                if k[i] - 'a' is not equal to in
                    set res = res + 'a' + in
                else do the following
                    if ch > 'a' and ch <= 'z'
                        set res = res + 'a'
                    else if ch='a'
                        set res = res + 'b'
                    else ch > 'A' and ch <= 'Z'
                        set res = res + 'a'
                    else if ch = 'A' then do the following
                        set res = res + 'b'
                end of the block
            else do the following
                if k[i] - 'A' is not equal to in
                    set res = res + 'A' + in
                else do the following
                    if ch > 'A' and ch <= 'Z'
                        set res =res + 'A'
                    else if ch = 'A
                        set res = res + 'B'
                    else if ch > 'a' and ch <= 'z'
                        set res = res + 'A'
                    else if ch = 'a' then do the following
                        set res = res + 'B'
                end of the block
            end of the block
        else do the following
            set res = res + k[i]
    end of the block
    print res
    return to indicate successful execution
end of the block

[CODE]:

vector<string> fs;
long long int valid[200];
int main() {
    long long int n, in;
    cin >> n;
    string h, w, k;
    char ch;
    for (int i = 0; i < n; i++) {
        cin >> h;
        transform(h.begin(), h.end(), h.begin(), ::tolower);
        fs.push_back(h);
    }
    cin >> w >> ch;
    if (ch - 'a' >= 0 && 'z' - ch >= 0) {
        in = ch - 'a';
    } else {
        in = ch = 'A';
    }
    k = w;
    transform(w.begin(), w.end(), w.begin(), ::tolower);
    for (int i = 0; i < n; i++) {
        long long int z = fs[i].length();
        for (int j = 0; j < w.length(); j++) {
            string temp = "";
            for (int k = j; k < j + z; k++) temp += w[k];
            if (temp == fs[i])
                for (int k = j; k < j + z; k++) valid[k] = 1;
        }
    }
    string res = "";
    for (int i = 0; i < w.length(); i++) {
        if (valid[i]) {
            if (k[i] >= 'a' && k[i] <= 'z') {
                if (k[i] - 'a' != in)
                    res += 'a' + in;
                else {
                    if (ch > 'a' && ch <= 'z') {
                        res += 'a';
                    } else if (ch == 'a')
                        res += 'b';
                    else if (ch > 'A' && ch <= 'Z') {
                        res += 'a';
                    } else if (ch == 'A')
                        res += 'b';
                }
            } else {
                if (k[i] - 'A' != in)
                    res += 'A' + in;
                else {
                    if (ch > 'A' && ch <= 'Z') {
                        res += 'A';
                    } else if (ch == 'A')
                        res += 'B';
                    else if (ch > 'a' && ch <= 'z') {
                        res += 'A';
                    } else if (ch == 'a')
                        res += 'B';
                }
            }
        } else
            res += k[i];
    }
    cout << res << endl;
    return 0;
}