[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]:
declare constant integer MAX = 2e6, mod = 998244353
declare integer array dp size MAX by 26
declare boolean ck with long longs lu, ld, ru, rd as arguments
    if lu is true
        declare long long step = absolute value of ( ld / lu )
        if lu * step is ld and ru * step is rd, return 1
    end of the block
    if ru is true
        declare long long step = absolute value of rd / ru
        if lu * step is ld and ru * step is rd, return 1
    end of the block
    return to indicate successful execution
end of the block
define the main function
    declare integers a, b
    declare string x
    read a, b, x
    declare integer n = size of x
    declare long longs tx = 0, ty = 0
    declare long longs cx = 0, cy = 0
    for i = 0 to n exclusive
        if x[i] is 'R'
            increment tx
        else if x[i] is 'L'
            decrement tx
        else if x[i] is 'U'
            increment ty
        else if x[i] is 'D'
            decrement ty
    end of the block
    if result of ck(tx, a, ty, b) or ( a is tx and b is ty ), return print ( "Yes" ), 0
    for i = 0 to n exclusive
        if x[i] is 'R'
            increment cx
        else if x[i] is 'L'
            decrement cx
        else if x[i] is 'U'
            increment cy
        else if x[i] is 'D'
            decrement cy
        if result of run ck with tx, a - cx, ty, b- cy as arguments or ( a is cx and b is cy ) return print ( "Yes" ), 0
    end of the block
    print "No"
end of the block

[CODE]:

const int MAX = 2e6, mod = 998244353;
int dp[MAX][26];
bool ck(long long lu, long long ld, long long ru, long long rd) {
    if (lu) {
        long long step = abs(ld / lu);
        if (lu * step == ld && ru * step == rd) return 1;
    }
    if (ru) {
        long long step = abs(rd / ru);
        if (lu * step == ld && ru * step == rd) return 1;
    }
    return 0;
}
int main() {
    int a, b;
    string x;
    cin >> a >> b >> x;
    int n = x.size();
    long long tx = 0, ty = 0;
    long long cx = 0, cy = 0;
    for (int i = 0; i < n; i++) {
        if (x[i] == 'R')
            tx++;
        else if (x[i] == 'L')
            tx--;
        else if (x[i] == 'U')
            ty++;
        else if (x[i] == 'D')
            ty--;
    }
    if (ck(tx, a, ty, b) || (a == tx && b == ty)) return puts("Yes"), 0;
    for (int i = 0; i < n; i++) {
        if (x[i] == 'R')
            cx++;
        else if (x[i] == 'L')
            cx--;
        else if (x[i] == 'U')
            cy++;
        else if (x[i] == 'D')
            cy--;
        if (ck(tx, a - cx, ty, b - cy) || (a == cx && b == cy)) return puts("Yes"), 0;
    }
    puts("No");
}


[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]:
define the main function
    let a, b long longs
    let in a string
    read a, b, and in
    let x, y long longs both with value 0
    let len a long long with value length of in
    let zx, zy long longs both with value 0
    for long long i = 0 to len exclusive
        if zx is a and zy is b
            print Yes
            return to indicate successful execution
        end of the block
        if in[i] is U, increment zy
        if in[i] is D, decrement zy
        if in[i] is L, decrement zx
        if in[i] is R, increment zx
    end of the block
    if zx and zy are 0
        print No
        return to indicate successful execution
    end of the block
    for i = 0 to len exclusive
        if in[i] is U, increment y
        if in[i] is D, decrement y
        if in[i] is L, decrement x
        if in[i] is R, increment x
        let chax, chay long longs with chax = a - x and chay = b - y
        if zx is 0
            if chay mod zy is 0 and zx is chax
                if chay / zy is at least 0
                    print Yes
                    return to indicate successful execution
                end of the block
            end of the block
        otherwise, if zy is 0
            if chax mod zx is 0 and zy equals chay
                if chax / zx is at least 0
                    print Yes
                    return to indicate successful execution
                end of the block
            end of the block
        otherwise if chax mod zx is 0 and chay mod zy is 0
            if chax / zx = chay / zy and chax / zx is at least 0 and chay / zy is at least 0
                print Yes
                return to indicate successful execution
            end of the block
        end of the block
    end of the block
    print No
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long a, b;
    string in;
    cin >> a >> b >> in;
    long long x = 0, y = 0;
    long long len = in.length();
    long long zx = 0, zy = 0;
    for (long long i = 0; i < len; i++) {
        if (zx == a && zy == b) {
            cout << "Yes" << endl;
            return 0;
        }
        if (in[i] == 'U') { zy++; }
        if (in[i] == 'D') { zy--; }
        if (in[i] == 'L') { zx--; }
        if (in[i] == 'R') { zx++; }
    }
    if (zx == 0 && zy == 0) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < len; i++) {
        if (in[i] == 'U') { y++; }
        if (in[i] == 'D') { y--; }
        if (in[i] == 'L') { x--; }
        if (in[i] == 'R') { x++; }
        long long chax = a - x, chay = b - y;
        if (zx == 0) {
            if (chay % zy == 0 && zx == chax) {
                if (chay / zy >= 0) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        } else if (zy == 0) {
            if (chax % zx == 0 && zy == chay) {
                if (chax / zx >= 0) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        } else if (chax % zx == 0 && chay % zy == 0) {
            if (chax / zx == chay / zy && chax / zx >= 0 && chay / zy >= 0) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


[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]:
define the main function
    a, b = long long
    loop while reading a then b
        s = string
        x, y = long long with x = 0 and y = 0
        read s
        i = long long
        for i = 0 to size of s
            if x is a and y is b break
            if s[i] is 'L' decrement x
            if s[i] is 'R' increment x
            if s[i] is 'U' increment y
            if s[i] is 'D' decrement y
        end of the block
        j = long long
        if i is size of s
            for j = 0 to size of s
                if s[j] is 'L' increment a
                if s[j] is 'R' decrement a
                if s[j] is 'U' decrement b
                if s[j] is 'D' increment b
                if a and b are both 0 break
                da = long long with da = absolute of a
                db = long long with db = absolute of b
                dx = long long with dx = absolute of x
                dy = long long with dy = absolute of y
                if a as long long * y is b as long long * x and a as long long * x >= 0 and b as long long * y >= 0
                    if a and b are both not 0
                        if dx and dy are both not 0
                            if da is a multiple of dx and db is a multiple of dy break
                        end of the block
                    else if a is not 0 and b is 0
                        if dx is not 0
                            if dy is 0 and da is a multiple of dx break
                        end of the block
                    else if a is 0 and b is not 0
                        if dy is not 0
                            if dx is 0 and db is a multiple of dy break
                        end of the block
                    end of the block
                end of the block
            end of the block
            if j is not size of s
                print "Yes"
            else
                print "No"
            end of the block
        else
            print "Yes"
        end of the block
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    long long a, b;
    while (cin >> a >> b) {
        string s;
        long long x = 0, y = 0;
        cin >> s;
        long long i;
        for (i = 0; i < s.size(); i++) {
            if (x == a && y == b) break;
            if (s[i] == 'L') x -= 1;
            if (s[i] == 'R') x += 1;
            if (s[i] == 'U') y += 1;
            if (s[i] == 'D') y -= 1;
        }
        long long j;
        if (i == s.size()) {
            for (j = 0; j < s.size(); j++) {
                if (s[j] == 'L') a += 1;
                if (s[j] == 'R') a -= 1;
                if (s[j] == 'U') b -= 1;
                if (s[j] == 'D') b += 1;
                if (a == 0 && b == 0) break;
                long long da = abs(a);
                long long db = abs(b);
                long long dx = abs(x);
                long long dy = abs(y);
                if ((long long)a * y == (long long)b * x && (long long)a * x >= 0 && (long long)b * y >= 0) {
                    if (a != 0 && b != 0) {
                        if (dx != 0 && dy != 0) {
                            if (da % dx == 0 && db % dy == 0) break;
                        }
                    } else if (a != 0 && b == 0) {
                        if (dx != 0) {
                            if (dy == 0 && da % dx == 0) break;
                        }
                    } else if (a == 0 && b != 0) {
                        if (dy != 0) {
                            if (dx == 0 && db % dy == 0) break;
                        }
                    }
                }
            }
            if (j != s.size()) {
                cout << "Yes" << endl;
            } else {
                cout << "No" << endl;
            }
        } else {
            cout << "Yes" << endl;
        }
    }
    return 0;
}


[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]:
s = string
a, b = integer
cx, cy = integers with cx = 0, cy = 0
define the main function
    read a, b
    read s
    for i = 0 to ((cast to int)(s).size())
        if cx is a and cy is b
            print Yes
            return to indicate successful execution
        end of the block
        if s[i] is U
            increment cy
        else if s[i] is D
            cy decrement
        else if s[i] is R
            increment cx
        else
            decrement cx
        if cx is a and cy is b
            print Yes
            return to indicate successful execution
        end of the block
    end of the block
    if cx
        t = integer with t = abs(a) / abs(cx)
        for now = t - 1000 to t + 1000
            if now < 0, continue new iteration
            first = long long with first = (cast to long long)cx * now
            second = long long with second = (cast to long long)cy * now
            for i = 0 to ((cast to int)(s).size())
                if first is a and second is b
                    print Yes
                    return to indicate successful execution
                end of the block
                if s[i] is U
                    increment second
                else if s[i] is D
                    decrement second
                else if s[i] is R
                    increment first
                else
                    decrement first
                if first is a and second is b
                    print Yes
                    return to indicate successful execution
                end of the block
            end of the block
        end of the block
    end of the block
    if cy
        t = integer with t = abs(b) / abs(cy)
        for now = t - 1000 to t + 1000
            if now < 0, continue next iteration
            first = long long with first = (cast to long long)cx * now
            second = long long with second = (cast to long long)cy * now
            for i = 0 to ((cast to int)(s).size())
                if first is a and second is b
                    print Yes
                    return to indicate successful execution
                end of the block
                if s[i] is U
                    increment second
                else if s[i] is D
                    decrement second
                else if s[i] is R
                    increment first
                else
                    decrement first
                if first is a and second is b
                    print Yes
                    return to indicate successful execution
                end of the block
            end of the block
        end of the block
    end of the block
    print No
end of the block

[CODE]:

string s;
int a, b;
int cx = 0, cy = 0;
int main() {
    cin >> a >> b;
    cin >> s;
    for (int i = 0; i < ((int)(s).size()); ++i) {
        if (cx == a && cy == b) {
            cout << "Yes\n";
            return 0;
        }
        if (s[i] == 'U')
            cy++;
        else if (s[i] == 'D')
            cy--;
        else if (s[i] == 'R')
            cx++;
        else
            cx--;
        if (cx == a && cy == b) {
            cout << "Yes\n";
            return 0;
        }
    }
    if (cx) {
        int t = abs(a) / abs(cx);
        for (int now = t - 1000; now <= t + 1000; ++now) {
            if (now < 0) continue;
            long long first = (long long)cx * now;
            long long second = (long long)cy * now;
            for (int i = 0; i < ((int)(s).size()); ++i) {
                if (first == a && second == b) {
                    cout << "Yes\n";
                    return 0;
                }
                if (s[i] == 'U')
                    second++;
                else if (s[i] == 'D')
                    second--;
                else if (s[i] == 'R')
                    first++;
                else
                    first--;
                if (first == a && second == b) {
                    cout << "Yes\n";
                    return 0;
                }
            }
        }
    }
    if (cy) {
        int t = abs(b) / abs(cy);
        for (int now = t - 1000; now <= t + 1000; ++now) {
            if (now < 0) continue;
            long long first = (long long)cx * now;
            long long second = (long long)cy * now;
            for (int i = 0; i < ((int)(s).size()); ++i) {
                if (first == a && second == b) {
                    cout << "Yes\n";
                    return 0;
                }
                if (s[i] == 'U')
                    second++;
                else if (s[i] == 'D')
                    second--;
                else if (s[i] == 'R')
                    first++;
                else
                    first--;
                if (first == a && second == b) {
                    cout << "Yes\n";
                    return 0;
                }
            }
        }
    }
    cout << "No\n";
}


[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]:
let fx, fy, dx, dy ints, all with value 0
define the main function
    read fx and fy
    let c a string
    read c
    if fx and fy are 0, print Yes and return 0
    for i = 0 to length of c exclusive
        if c[i] is u
            increment dy
        otherwise if c[i] is D
            decrement dy
        otherwise, if c[i] is L
            decrement dx
        otherwise
            increment dx
    end of the block
    for i = 0 to size of c exclusive
        let nx, ny ints with value 0
        for j = 0 to i inclusive
            if c[j] is U
                increment ny
            otherwise if c[j] is D
                decrement ny
            otherwise if c[j] is L
                decrement nx
            otherwise
                increment nx
        end of the block
        if nx equals fx and ny equals fy, print Yes and return 0
        let k1 and k2 be integers with value 0
        if dx is not 0, set k1 to (fx - nx) / dx
        if dy is not 0, set k2 = (fy - ny) / dy
        if dx is 0, set k1 equals k2
        if dy is 0, set k2 equals k1
        if k1 * dx + nx = fx and k2 * dy + ny = fy and k1 nonnegative, print Yes and return 0
    end of the block
    print No and return 0
end of the block

[CODE]:

int fx = 0, fy = 0, dx = 0, dy = 0;
int main() {
    cin >> fx >> fy;
    string c;
    cin >> c;
    if (fx == 0 && fy == 0) return cout << "Yes" << endl, 0;
    for (int i = 0; i < c.size(); i++) {
        if (c[i] == 'U')
            dy++;
        else if (c[i] == 'D')
            dy--;
        else if (c[i] == 'L')
            dx--;
        else
            dx++;
    }
    for (int i = 0; i < c.size(); i++) {
        int nx = 0, ny = 0;
        for (int j = 0; j <= i; j++) {
            if (c[j] == 'U')
                ny++;
            else if (c[j] == 'D')
                ny--;
            else if (c[j] == 'L')
                nx--;
            else
                nx++;
        }
        if (nx == fx && ny == fy) return cout << "Yes" << endl, 0;
        int k1 = 0, k2 = 0;
        if (dx != 0) k1 = (fx - nx) / dx;
        if (dy != 0) k2 = (fy - ny) / dy;
        if (dx == 0) k1 = k2;
        if (dy == 0) k2 = k1;
        if (k1 * dx + nx == fx && k2 * dy + ny == fy && k1 == k2 && k1 >= 0) return cout << "Yes" << endl, 0;
    }
    return cout << "No" << endl, 0;
}


[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]:
create long long vector prime of size 10000005 and value 0
declare mM taking in long long ints a, b, and mod and returning long long
    create long long res = 0
    set a to a % mod
    while b is truthy
        if b & 1 is truthy, set res to (res + a) % mod
        set a to (2 * a) % mod
        move bits of b 1 place to the right
    end of the block
    return res
end of the block
declare fpow taking long long ints first, second, and p and returning long long integer
    set first to first % p
    make long long res = 1
    while second is truthy
        if second & 1 is truthy, set res to (res * first) % p
        set res to res % p
        if res is less than 0, set res to (res + p) % p
        set second to second >> 1
        set first to (first * first) % p
        if first is less than 0, set first to (first + p) % p
        set first to first % p
    end of the block
    return res
end of the block
declare inv taking in long long int n and returning long long
    return the result of fpow(n, 1000000007 - 2, 1000000007)
end of the block
declare modmul taking in long long ints first and second and returning long long
    return ((first % 1000000007) * (second % 1000000007)) % 1000000007
end of the block
declare modadd taking in long long ints first and second and returning long long integer
    create long long temp = first % 1000000007 + second % 1000000007
    set temp to temp % 1000000007
    if temp is less than 0, set temp to (temp + 1000000007) % 1000000007
    return temp
end of the block
declare sieve
    set prime[1] to 1
    for i = 2 to 10000005 exclusive
        if prime[i] is falsy
            for j = i to 10000005 exclusive
                if !prime[j] is truthy, set prime[j] to i
end of the block
define the main function
    create long long integer t
    set t to 1
    while t-- is truthy
        create long long integer n
        read n
        make string vector s of size n
        for i = 0 to n exclusive, read s[i]
        make string w
        create char tc
        read w and tc
        make long long vector check of size w.size() and value 0
        for i = 0 to n exclusive
            for j = 0 to w.size() exclusive
                create string s1 = w.substr(j, s[i].size())
                create bool ok = true
                if size of s1 is less than size of s[i]
                    set ok to false
                else do
                    make string temp = s[i]
                    make all contents of temp lowercase
                    make all content of s1 lowercase
                    if s1 is not equal to temp, set ok to false
                end of the block
                if ok is truthy
                    for k = j while k < j + s[i].size(), set check[k] to 1
            end of the block
        for i = 0 to w.size() exclusive
            if check[i] is truthy
                create char temp = w[i]
                if temp is greater than or equal to 'A' and temp is less than or equal to 'Z'
                    set temp to temp - 'A'
                else do
                    subtract 'a' from temp
                add 'a' to temp
                if temp is equal to tc and tc is equal to 'a'
                    if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'
                        set w[i] to 'b'
                    else do
                        set w[i] to 'B'
                else if temp is equal to tc and tc is not equal to 'a'
                    if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'
                        set w[i] to 'a'
                    otherwise
                        set w[i] to 'A'
                else
                    if w[i] is greater than or equal to 'a' and w[i] is less than or equal to 'z'
                        set w[i] to tc
                    else do
                        set w[i] to tc - 'a' + 'A'
                end of the block
            end of the block
        print w
    end of the block
end of the block

[CODE]:

vector<long long> prime(10000005, 0);
long long mM(long long a, long long b, long long mod) {
    long long res = 0;
    a %= mod;
    while (b) {
        if (b & 1) res = (res + a) % mod;
        a = (2 * a) % mod;
        b >>= 1;
    }
    return res;
}
long long fpow(long long first, long long second, long long p) {
    first = first % p;
    long long res = 1;
    while (second) {
        if (second & 1) res = (res * first) % p;
        res %= p;
        if (res < 0) res = (res + p) % p;
        second = second >> 1;
        first = (first * first) % p;
        if (first < 0) first = (first + p) % p;
        first %= p;
    }
    return res;
}
long long inv(long long n) {
    return fpow(n, 1000000007 - 2, 1000000007);
}
long long modmul(long long first, long long second) {
    return ((first % 1000000007) * (second % 1000000007)) % 1000000007;
}
long long modadd(long long first, long long second) {
    long long temp = first % 1000000007 + second % 1000000007;
    temp %= 1000000007;
    if (temp < 0) temp = (temp + 1000000007) % 1000000007;
    return temp;
}
void sieve() {
    prime[1] = 1;
    for (long long i = 2; i < 10000005; i++)
        if (!prime[i])
            for (long long j = i; j < 10000005; j += i)
                if (!prime[j]) prime[j] = i;
}
int main() {
    long long t;
    t = 1;
    while (t--) {
        long long n;
        cin >> n;
        vector<string> s(n);
        for (int i = 0; i < n; i++) cin >> s[i];
        string w;
        char tc;
        cin >> w >> tc;
        vector<long long> check(w.size(), 0);
        for (int i = 0; i < n; i++)
            for (int j = 0; j < w.size(); j++) {
                string s1 = w.substr(j, s[i].size());
                bool ok = true;
                if (s1.size() < s[i].size())
                    ok = false;
                else {
                    string temp = s[i];
                    transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
                    transform(s1.begin(), s1.end(), s1.begin(), ::tolower);
                    if (s1 != temp) ok = false;
                }
                if (ok)
                    for (int k = j; k < j + s[i].size(); k++) check[k] = 1;
            }
        for (int i = 0; i < w.size(); i++)
            if (check[i]) {
                char temp = w[i];
                if (temp >= 'A' && temp <= 'Z')
                    temp -= 'A';
                else
                    temp -= 'a';
                temp += 'a';
                if (temp == tc && tc == 'a') {
                    if (w[i] >= 'a' && w[i] <= 'z')
                        w[i] = 'b';
                    else
                        w[i] = 'B';
                } else if (temp == tc && tc != 'a') {
                    if (w[i] >= 'a' && w[i] <= 'z')
                        w[i] = 'a';
                    else
                        w[i] = 'A';
                } else {
                    if (w[i] >= 'a' && w[i] <= 'z')
                        w[i] = tc;
                    else
                        w[i] = tc - 'a' + 'A';
                }
            }
        cout << w << "\n";
    }
}

4 hello party abefglghjdhfgj IVan petrsmatchwin a

4 Efron Keyt cesho cool CodeForcesHockeyTeam p

4 Efron Keyt cesho cool CodeForcesOldHockeyNewTeam p

47 V S g r C R B b l W J i U n q q j L R u Q C f C U u x h q E Y u K t M U A A s i V T j b k W N NlVwRlWzQQWoCI z

47 jw L xIp W I aI Ep ylG Ne EglZ oYkyo wDuZK DVh uoAoF GWj t P uNQz bPSg eqru xvll O mb CM wnmvv YpFsq FYID c r rhbl YseyB RGcRj hDtz W QlQWB Y ftSl yPlAd LPgVw EIGOF TQ QrFcr spu K IJ fXUd GhpV DxUhKXELSLIiJMIOsbrpPQPXFwH w

74 M LQ H cA qj D nj zD jM s R oC Fh lO j c En AB sw T z Eb b u mj MI D j H p zD V R vg H S By u QP B dD rI JF nA sv z a l I FJ K H T F l tC g s Nl Uj u A OO Ld k k kM LY bn v fT C I c aeBolOleYgGmSLkFCPJPbQZUeodomjS v

99 s c N N i i W J A W m B f O m k Q f x p l H H o n C K R s T J v C Z d l r o D g a A E k N w a b o k v c i j E l o f v s h x m E N t j k g k X W i X m w K L Q r j f o w v S o H e L L d P r g z z q d BBPVyRDLuNwdkeSYWimsIMiAPiOMQfuDQMcLEly q

7 a h u p fgh wyz defghijkl abcdefghijklmnopqrstuvwxyz a

9 a h u p z fgh wyz defghijkl ghijklmnopqrstu abcdefghijklmnopqrstuvwxyz a


[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;
}


[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 int with MAXN = 200
bad = string, bool map
change = bool array of size MAXN
define the main function
    n = int
    read n
    for i = 0 to n
        s = string
        read s
        for t = 0 to length of s
            if s[t] >= 'A' and s[t] <= 'Z' set s[t] to 'a' + s[t] - 'A'
        set bad[s] to true
    end of the block
    u = string
    lucky = char
    read u then lucky
    for i = 0 to length of u
        cur = string
        for t = i to length of u
            increment cur by (u[t] - 'A' + 'a') as char if u[t] >= 'A' and u[t] <= 'Z' else u[t]
            if bad[cur]
                for j = i to t inclusive set change[j] to true
        end of the block
    end of the block
    for i = 0 to length of u
        if change[i]
            if u[i] is lucky
                if lucky is 'a'
                    set u[i] to 'b'
                else
                    set u[i] to 'a'
            else if u[i] - 'A' + 'a' is lucky
                if lucky is 'a'
                    set u[i] to 'B'
                else
                    set u[i] to 'A'
            else if u[i] >= 'A' and u[i] <= 'Z'
                set u[i] to lucky - 'a' + 'A'
            else
                set u[i] to lucky
    print u
end of the block

[CODE]:

const int MAXN = 200;
map<string, bool> bad;
bool change[MAXN];
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        for (int t = 0; t < s.length(); t++)
            if (s[t] >= 'A' && s[t] <= 'Z') s[t] = 'a' + s[t] - 'A';
        bad[s] = true;
    }
    string u;
    char lucky;
    cin >> u >> lucky;
    for (int i = 0; i < u.length(); i++) {
        string cur;
        for (int t = i; t < u.length(); t++) {
            cur += ((u[t] >= 'A' && u[t] <= 'Z') ? (char)(u[t] - 'A' + 'a') : u[t]);
            if (bad[cur])
                for (int j = i; j <= t; j++) change[j] = true;
        }
    }
    for (int i = 0; i < u.length(); i++)
        if (change[i])
            if (u[i] == lucky)
                if (lucky == 'a')
                    u[i] = 'b';
                else
                    u[i] = 'a';
            else if (u[i] - 'A' + 'a' == lucky)
                if (lucky == 'a')
                    u[i] = 'B';
                else
                    u[i] = 'A';
            else if (u[i] >= 'A' && u[i] <= 'Z')
                u[i] = lucky - 'a' + 'A';
            else
                u[i] = lucky;
    cout << u << "\n";
}


[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]:
define the main function
    n = integer
    read n
    forbid = vector of string
    for i = 0 to n exclusive
        s = string
        read s
        s1 = string with s1 = ""
        for j = 0 to s.size() exclusive
            a = character with a = s[j]
            if (a <= Z), a = a - A + a
            s1 = s1 + a
        end of the block
        append s1 to forbid
    end of the block
    occur = vector integer array of size 100
    s = string
    read s
    s1 = string with s1 = ""
    for j = 0 to s.size() exclusive
        a = character with a = s[j]
        if (a <= Z), a = a - A + a
        s1 = s1 + a
    end of the block
    for i = 0 to n exclusive
        copy = string with copy = s1
        pre = integer with pre = 0
        while (copy.size() > 0 and copy.find(forbid[i]) is not npos string)
            append copy.find(forbid[i]) + pre to occur[i]
            pre = pre + copy.find(forbid[i]) + 1
            copy = copy.substr(copy.find(forbid[i]) + 1)
        end of the block
    end of the block
    letter = character
    read letter
    first = bool array of size 100
    important = integer array of size 100
    set all contents of first to true
    set all contents of important to 0
    for i = 0 to n exclusive
        for j = 0 to occur[i].size() exclusive
            for k = 0 to occur[i][j] + k < s.size() and k < forbid[i].size()
                if (first[occur[i][j] + k])
                    first[occur[i][j] + k] = false
                    if (s[occur[i][j] + k] is letter)
                        important[occur[i][j] + k] = 1
                    else if (s[occur[i][j] + k] is letter - a + A)
                        important[occur[i][j] + k] = 2
                    end of the block
                end of the block
                if (s[occur[i][j] + k] <= Z)
                    s[occur[i][j] + k] = letter - a + A
                else
                    s[occur[i][j] + k] = letter
            end of the block
        end of the block
    end of the block
    for i = 0 to s.size() exclusive
        c1 = character with c1 = a
        if (letter is a), c1 = b
        if (important[i] is 1)
            s[i] = c1
        else if (important[i] is 2)
            s[i] = c1 - a + A
        end of the block
    end of the block
    print s
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    vector<string> forbid;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        string s1 = "";
        for (int j = 0; j < s.size(); j++) {
            char a = s[j];
            if (a <= 'Z') a = a - 'A' + 'a';
            s1 += a;
        }
        forbid.push_back(s1);
    }
    vector<int> occur[100];
    string s;
    cin >> s;
    string s1 = "";
    for (int j = 0; j < s.size(); j++) {
        char a = s[j];
        if (a <= 'Z') a = a - 'A' + 'a';
        s1 += a;
    }
    for (int i = 0; i < n; i++) {
        string copy = s1;
        int pre = 0;
        while (copy.size() > 0 && copy.find(forbid[i]) != string::npos) {
            occur[i].push_back(copy.find(forbid[i]) + pre);
            pre += copy.find(forbid[i]) + 1;
            copy = copy.substr(copy.find(forbid[i]) + 1);
        }
    }
    char letter;
    cin >> letter;
    bool first[100];
    int important[100];
    memset(first, true, sizeof(first));
    memset(important, 0, sizeof(important));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < occur[i].size(); j++) {
            for (int k = 0; occur[i][j] + k < s.size() && k < forbid[i].size(); k++) {
                if (first[occur[i][j] + k]) {
                    first[occur[i][j] + k] = false;
                    if (s[occur[i][j] + k] == letter) {
                        important[occur[i][j] + k] = 1;
                    } else if (s[occur[i][j] + k] == letter - 'a' + 'A') {
                        important[occur[i][j] + k] = 2;
                    }
                }
                if (s[occur[i][j] + k] <= 'Z')
                    s[occur[i][j] + k] = letter - 'a' + 'A';
                else
                    s[occur[i][j] + k] = letter;
            }
        }
    }
    for (int i = 0; i < s.size(); i++) {
        char c1 = 'a';
        if (letter == 'a') c1 = 'b';
        if (important[i] == 1) {
            s[i] = c1;
        } else if (important[i] == 2) {
            s[i] = c1 - 'a' + 'A';
        }
    }
    cout << s << endl;
    return 0;
}


[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';
}


[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;
}


[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]:
let maxn be const integer with maxn = 1e5 + 10
let arr be array of booleans of size maxn
let s be string and ss be array of strings of size maxn
let c be char
let n be integer
in function input
    read n
    for i = 0 to n exclusive, read ss[i]
    read s, c
end of the block
in function low which takes char x and returns char
    if x is greater than or equal to A and x is less than or equal to Z, update x to x - 'A' + 'a'
    return x
end of the block
define the main function
    call input
    let w be integer with w = size of s
    for i = 0 to n exclusive
        for wi = 0 to till wi + size of ss[i] - 1 is less than w
            let b be boolean with b = true
            for ssj = wi to till ssj is less than wi + size of ss[i]
                if low of s[ssj] is not equal to low of ss[i][ssj-wi]
                    set b to false
                    break
                end of the block
            end of the block
            if b is not false
                for ssj = wi to till ssj is less than wi + size of ss[i], set arr[ssj] to true
        end of the block
    end of the block
    for i = 0 to w exclusive
        if arr[i] is not zero
            if low of s[i] is equal to c
                if c is equal to 'a'
                    update s[i] to s[i] + ('b' - low of s[i])
                else
                    update s[i] to s[i] + ('a' - low of s[i])
            else
                update s[i] to s[i] + (c - low of s[i])
        end of the block
    print out s with newline
end of the block

[CODE]:

const int maxn = 1e5 + 10;
bool arr[maxn];
string s, ss[maxn];
char c;
int n;
void input() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> ss[i];
    cin >> s >> c;
}
char low(char x) {
    if (x >= 'A' && x <= 'Z') x = x - 'A' + 'a';
    return x;
}
int main() {
    input();
    int w = s.size();
    for (int i = 0; i < n; i++) {
        for (int wi = 0; wi + ss[i].size() - 1 < w; wi++) {
            bool b = true;
            for (int ssj = wi; ssj < wi + ss[i].size(); ssj++) {
                if (low(s[ssj]) != low(ss[i][ssj - wi])) {
                    b = false;
                    break;
                }
            }
            if (b)
                for (int ssj = wi; ssj < wi + ss[i].size(); ssj++) arr[ssj] = true;
        }
    }
    for (int i = 0; i < w; i++)
        if (arr[i]) {
            if (low(s[i]) == c) {
                if (c == 'a')
                    s[i] += ('b' - low(s[i]));
                else
                    s[i] += ('a' - low(s[i]));
            } else
                s[i] += (c - low(s[i]));
        }
    cout << s << endl;
}


[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]:
s = vector of string
b1 = bool array of size 100000
cap = bool array of size 100000
define the main function
    w = string
    s1 = string
    n = integer
    read n
    for i = 0 to n exclusive
        read s1
        for j = 0 to s1.length() exclusive
            if (s1[j] >= A and s1[j] <= Z), s1[j] = s1[j] + a - A
        append s1 in s
    end of the block
    read w
    set all contents of cap to 0
    for i = 0 to w.length() exclusive
        if (w[i] >= A and w[i] <= Z)
            cap[i] = true
            w[i] = w[i] + a - A
        end of the block
    b = bool
    set all contents of b1 to 0
    for i = 0 to n exclusive
        for j = 0 to w.length() exclusive
            b = true
            if (j + s[i].length() > w.length())
                b = false
            else
                for k = j to j + s[i].length() exclusive
                    if (w[k] is not s[i][k - j]), b = false
            end of the block
            if (b)
                for k = j to j + s[i].length(), b1[k] = true
            end of the block
        end of the block
    end of the block
    l = character
    read l
    for i = 0 to w.length() exclusive
        if (b1[i])
            if (w[i] is not l)
                w[i] = l
            else if (w[i] is not a)
                w[i] = a
            else
                w[i] = b
        end of the block
    for i = 0 to w.length() exclusive
        if (cap[i]), w[i] = w[i] + A - a
    print w
    return to indicate successful execution
end of the block

[CODE]:

vector<string> s;
bool b1[100000];
bool cap[100000];
int main() {
    string w;
    string s1;
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s1;
        for (int j = 0; j < s1.length(); j++)
            if (s1[j] >= 'A' && s1[j] <= 'Z') s1[j] += 'a' - 'A';
        s.push_back(s1);
    }
    cin >> w;
    memset(cap, 0, sizeof cap);
    for (int i = 0; i < w.length(); i++)
        if (w[i] >= 'A' && w[i] <= 'Z') {
            cap[i] = true;
            w[i] += 'a' - 'A';
        }
    bool b;
    memset(b1, 0, sizeof b1);
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < w.length(); j++) {
            b = true;
            if (j + s[i].length() > w.length())
                b = false;
            else {
                for (int k = j; k < j + s[i].length(); k++)
                    if (w[k] != s[i][k - j]) b = false;
            }
            if (b) {
                for (int k = j; k < j + s[i].length(); k++) b1[k] = true;
            }
        }
    }
    char l;
    cin >> l;
    for (int i = 0; i < w.length(); i++)
        if (b1[i]) {
            if (w[i] != l)
                w[i] = l;
            else if (w[i] != 'a')
                w[i] = 'a';
            else
                w[i] = 'b';
        }
    for (int i = 0; i < w.length(); i++)
        if (cap[i]) w[i] += 'A' - 'a';
    cout << w << endl;
    return 0;
}


[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]:
n, m = integers
k = integer
debug = bool with debug = false
bl = integer array of size 103
define the main function
    read n
    s, a, ss, S, let = strings with a = array of size n
    for i = 0 to n exclusive
        read a[i]
        transform(a[i].begin(), a[i].end(), a[i].begin(), tolower)
    end of the block
    read S, let
    resize S.size() of ss
    transform(S.begin(), S.end(), ss.begin(), tolower)
    for i = 0 to n exclusive
        pos = long long with pos = ss.find(a[i])
        while (pos is not string npos)
            for j = 0 to a[i].size() exclusive, bl[j + pos] = 1
            pos = ss.find(a[i], pos + 1)
        end of the block
    end of the block
    ans = string with ans = ""
    for i = 0 to ss.size() exclusive
        if (bl[i])
            if (ss[i] is let[0])
                if (ss[i] is not a)
                    if (isupper(S[i]))
                        ans = ans + A
                    else
                        ans = ans + a
                else
                    if (isupper(S[i]))
                        ans = ans + B
                    else
                        ans = ans + b
                end of the block
                continue next iteration
            end of the block
            if (isupper(S[i]))
                ans = ans + toupper(let[0])
            else
                ans = ans + let
        else
            ans = ans + S[i]
        end of the block
    end of the block
    print ans.c_str()
    return to indicate successful execution
end of the block

[CODE]:

int n, m;
int k;
bool debug = false;
int bl[103];
int main() {
    cin >> n;
    string s, a[n], ss, S, let;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        transform(a[i].begin(), a[i].end(), a[i].begin(), ::tolower);
    }
    cin >> S >> let;
    ss.resize(S.size());
    transform(S.begin(), S.end(), ss.begin(), ::tolower);
    for (int i = 0; i < n; i++) {
        long long pos = ss.find(a[i]);
        while (pos != string::npos) {
            for (int j = 0; j < a[i].size(); j++) { bl[j + pos] = 1; }
            pos = ss.find(a[i], pos + 1);
        }
    }
    string ans = "";
    for (int i = 0; i < ss.size(); i++) {
        if (bl[i]) {
            if (ss[i] == let[0]) {
                if (ss[i] != 'a') {
                    if (isupper(S[i]))
                        ans += 'A';
                    else
                        ans += 'a';
                } else {
                    if (isupper(S[i]))
                        ans += 'B';
                    else
                        ans += 'b';
                }
                continue;
            }
            if (isupper(S[i]))
                ans += toupper(let[0]);
            else
                ans += let;
        } else {
            ans += S[i];
        }
    }
    puts(ans.c_str());
    return 0;
}


[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]:
integer array = n,d[111]
array a size 111, s, t = string
create character variable
define the main function
    read n
    for i = 1 to less than or equal to n do the following
        read a[i]
        for j = 0 to less than a[i].size() do the following
            if a[i][j] is greater than or equal to a then subtract 32 from a[i][j]
    end of the block
    read s
    set t to s
    read lucky
    if lucky is greater than or equal to a then subtract 32 from lucky
    integers = sl = s.length()
    for i = 0 to less than sl do the following
        if s[i] is greater than or equal to a then subtract 32 from s[i], d[i] = 1
    end of the block
    for i = 0 to less than sl do the following
        for j = 1 to less than or equal to n do the following
            integers l = a[j].length()
            if i + l is less than or equal to sl and s.substr(i, l) is a[j]then do the following
                for k = 0 to less than l do the following
                    if s[i + k] is lucky then do the following
                        if lucky is A then do the following
                            set t[i + k] to b if d[i + k] is true or else d[i+k] = B)
                        else
                            set t[i + k] to b if d[i + k] is true or else d[i+k] = A)
                    else
                        set t[i + k] to lucky+32 if d[i + k]is true else t[i+k] = lucky
                end of the block
            end of the block
        end of the block
    end of the block
    output t
    return to indicate successful execution
end of the block

[CODE]:

int n, d[111];
string a[111], s, t;
char lucky;
int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        for (int j = 0; j < a[i].size(); j++)
            if (a[i][j] >= 'a') a[i][j] -= 32;
    }
    cin >> s;
    t = s;
    cin >> lucky;
    if (lucky >= 'a') lucky -= 32;
    int sl = s.length();
    for (int i = 0; i < sl; i++) {
        if (s[i] >= 'a') s[i] -= 32, d[i] = 1;
    }
    for (int i = 0; i < sl; i++) {
        for (int j = 1; j <= n; j++) {
            int l = a[j].length();
            if (i + l <= sl && s.substr(i, l) == a[j]) {
                for (int k = 0; k < l; k++) {
                    if (s[i + k] == lucky) {
                        if (lucky == 'A')
                            t[i + k] = (d[i + k] ? 'b' : 'B');
                        else
                            t[i + k] = (d[i + k] ? 'a' : 'A');
                    } else
                        t[i + k] = (d[i + k] ? lucky + 32 : lucky);
                }
            }
        }
    }
    cout << t << "\n";
    return 0;
}


[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]:
create constant integer variable with name N = 150
declare integer arrays x, y and info with size N, and a variable n
integer function color_to_id with char argument ch
    if ch = 'R', return 1
    if ch is equal to 'G', return 2
    if ch = 'B', return 3
    if ch = 'Y', return 4
    if ch is equal to 'W', return 5
end of the block
function count_one with int argument x that returns int
    create integer variable called cnt with value 0
    while x
        change cnt to the sum of cnt and x & 1
        change x to x >> 1
    end of the block
    return cnt
end of the block
bool function check with int argument sta
    for i = 0 to n exclusive incrementing i
        change info[i] to 0
        set info[i] to info[i] | (1 << (x[i] - 1)) & sta
        change the value of info[i] to info[i] | (1 << (y[i] - 1 + 5)) & sta
        in a for loop, change j from 0 to i exclusive
            return false if info[i] = info[j] and (x[i] != x[j] or y[i] != y[j])
    end of the block
    return true
end of the block
define the main function
    declare string variable with name str
    read n and loop further
        for i = 0 to n exclusive incrementing i
            read input to str
            change the value of x[i] to color_to_id(str[0])
            set y[i] to str[1] - '0'
        end of the block
        define integer ans with value 10
        for integer i = 0 to 1 << 10 exclusive
            declare new integer variable n_one with value = result of count_one(i)
            if n_one >= ans, go to the start of the loop
            if check(i) returned true, set the value of ans to n_one
        end of the block
        print ans
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

const int N = 150;
int x[N], y[N], info[N], n;
int color_to_id(char ch) {
    if (ch == 'R') return 1;
    if (ch == 'G') return 2;
    if (ch == 'B') return 3;
    if (ch == 'Y') return 4;
    if (ch == 'W') return 5;
}
int count_one(int x) {
    int cnt = 0;
    while (x) {
        cnt += (x & 1);
        x >>= 1;
    }
    return cnt;
}
bool check(int sta) {
    for (int i = 0; i < n; i++) {
        info[i] = 0;
        info[i] |= (1 << (x[i] - 1)) & sta;
        info[i] |= (1 << (y[i] - 1 + 5)) & sta;
        for (int j = 0; j < i; j++)
            if (info[i] == info[j] && (x[i] != x[j] || y[i] != y[j])) return false;
    }
    return true;
}
int main() {
    string str;
    while (cin >> n) {
        for (int i = 0; i < n; i++) {
            cin >> str;
            x[i] = color_to_id(str[0]);
            y[i] = str[1] - '0';
        }
        int ans = 10;
        for (int i = 0; i < (1 << 10); i++) {
            int n_one = count_one(i);
            if (n_one >= ans) continue;
            if (check(i)) ans = n_one;
        }
        cout << ans << endl;
    }
    return 0;
}

W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5

B5 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B2 G2 R3 B2 R1 W2 B4

W4 Y5 Y3 Y3 R5 W3 R5 W2 R5 Y2 R2 Y2 G2 G3 Y4 Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2

Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3

W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3

Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5

W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2

Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4

B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1

G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3

R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5

Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1


[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]:
ans, n = int and b = int array of size 20
a = two dimensional bool array of sizes 10 and 10
in function check returning bool
    i, j, r, l, tot = int
    for i = 1 to 5 inclusive
        set l and r to 0
        for j = 1 to 5 inclusive
            if a[i][j]
                increment l
                if b[j] increment r
            end of the block
        end of the block
        if l - 1 > r return false
    end of the block
    for i = 1 to 5 inclusive
        set l and r to 0
        for j = 1 to 5 inclusive
            if a[i][j]
                increment l
                if b[5 + j] increment r
            end of the block
        end of the block
        if l - 1 > r return false
    end of the block
    set tot to 0
    for i = 1 to 5 inclusive
        for j = 1 to 5 inclusive
            if a[i][j] and not b[i + 5] and not b[j] increment tot
        end of the block
    end of the block
    if tot > 1 return false
    return true
end of the block
in function dfs taking int x
    i, sum = int
    if x is 11
        if check
            set sum to 0
            for i = 1 to 11 inclusive
                if b[i] is 1 increment sum
            end of the block
            set ans to min of sum, ans
        end of the block
        return
    end of the block
    set b[x] to 1
    call dfs of x + 1
    set b[x] to 0
    call dfs of x + 1
end of the block
define the main function
    i, y = int
    ch = char
    k = int
    read n
    set all values of a to false
    for i = 1 to n inclusive
        read ch then k
        if ch is 'R'
            set y to 1
        else if ch is 'G'
            set y to 2
        else if ch is 'B'
            set y to 3
        else if ch is 'Y'
            set y to 4
        else if ch is 'W'
            set y to 5
        set a[y][k] to true
    end of the block
    set all values of b to 0
    set ans to 9999999
    noop
    call dfs of 1
    print ans
end of the block

[CODE]:

int b[20], ans, n;
bool a[10][10];
bool check() {
    int i, j, r, l, tot;
    for (i = 1; i <= 5; i++) {
        l = r = 0;
        for (j = 1; j <= 5; j++) {
            if (a[i][j]) {
                l++;
                if (b[j]) { r++; }
            }
        }
        if (l - 1 > r) return false;
    }
    for (i = 1; i <= 5; i++) {
        l = r = 0;
        for (j = 1; j <= 5; j++) {
            if (a[j][i]) {
                l++;
                if (b[5 + j]) r++;
            }
        }
        if (l - 1 > r) return false;
    }
    tot = 0;
    for (i = 1; i <= 5; i++) {
        for (j = 1; j <= 5; j++) {
            if (a[i][j] && !b[i + 5] && !b[j]) tot++;
        }
    }
    if (tot > 1) return false;
    return true;
}
void dfs(int x) {
    int i, sum;
    if (x == 11) {
        if (check()) {
            sum = 0;
            for (i = 1; i <= 11; i++) {
                if (b[i] == 1) sum++;
            }
            ans = min(sum, ans);
        }
        return;
    }
    b[x] = 1;
    dfs(x + 1);
    b[x] = 0;
    dfs(x + 1);
}
int main() {
    int i, y;
    char ch;
    int k;
    cin >> n;
    memset(a, false, sizeof(a));
    for (i = 1; i <= n; i++) {
        cin >> ch >> k;
        if (ch == 'R')
            y = 1;
        else if (ch == 'G')
            y = 2;
        else if (ch == 'B')
            y = 3;
        else if (ch == 'Y')
            y = 4;
        else if (ch == 'W')
            y = 5;
        a[y][k] = true;
    }
    memset(b, 0, sizeof(b));
    ans = 9999999;
    ;
    dfs(1);
    cout << ans << endl;
}

W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5

B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 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Y4 R4 Y3 G2 W2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2

Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3

W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3

Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5

W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2

Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4

B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1

G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3

R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5

Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1


[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]:
new static double constant EPS = 1e-5
new chat array colortable with elements 'R', 'G', 'B', 'Y' and 'W'
int function getX with string argument s
    for i from 0 to 5 exclusive incrementing i
        if colortable[i] is equal to s[0], return i
    end of the block
    return -1
end of the block
getY is a integer function with string argument s
    return s[1] - '1'
end of the block
bitcount is a int function with int argument b
    declare new integer variable ans = 0
    while b != 0
        increment ans
        change b to b & (b - 1)
    end of the block
    return ans
end of the block
bool function check with int arguments maskX and maskY and string arguments C1 and C2
    x1 is a new integer = result of getX(C1)
    create new integer variable x2 with value from getX(C2)
    declare integer variable y1 = value, returned by getY(C1)
    declare integer y2 = result of getY(C2)
    return true if x1 is equal to x2 and y1 = y2
    if x1 != x2
        if (maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0, return true
    end of the block
    if y1 != y2
        if (maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0, return true
    end of the block
    return false
end of the block
define the main function
    declare new integer variable n
    read n
    cards is a new vector of strings with n elements
    read n elements from the input into cards in a loop
    declare new integer ans = 100000
    sort cards
    remove duplicates from cards
    start for loop from maskX = 0 to 1 << 5 exclusive
        start for loop from maskY = 0 to 1 << 5 exclusive incrementing maskY
            create boolean variable with name ok = true
            incremen i in a loop from 0, while ok is true and i < size of cards
                for j from i + 1 to exclusive, assign the result of check(maskX, maskY, cards[i], cards[j]) to ok
            end of the block
            if ok is true, set the value of ans to min of ans and bitcount(maskX) + bitcount(maskY)
        end of the block
    end of the block
    print ans to the standard output
    return to indicate successful execution
end of the block

[CODE]:

static const double EPS = 1e-5;
char colortable[] = {'R', 'G', 'B', 'Y', 'W'};
int getX(string s) {
    for (int i = 0; i < 5; i++) {
        if (colortable[i] == s[0]) return i;
    }
    return -1;
}
int getY(string s) {
    return s[1] - '1';
}
int bitcount(int b) {
    int ans = 0;
    while (b != 0) {
        ans++;
        b &= b - 1;
    }
    return ans;
}
bool check(int maskX, int maskY, string C1, string C2) {
    int x1 = getX(C1);
    int x2 = getX(C2);
    int y1 = getY(C1);
    int y2 = getY(C2);
    if (x1 == x2 && y1 == y2) return true;
    if (x1 != x2) {
        if ((maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0) return true;
    }
    if (y1 != y2) {
        if ((maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0) return true;
    }
    return false;
}
int main() {
    int n;
    cin >> n;
    vector<string> cards(n);
    for (int i = 0; i < n; i++) cin >> cards[i];
    int ans = 100000;
    sort(cards.begin(), cards.end());
    cards.erase(unique(cards.begin(), cards.end()), cards.end());
    for (int maskX = 0; maskX < (1 << 5); maskX++) {
        for (int maskY = 0; maskY < (1 << 5); maskY++) {
            bool ok = true;
            for (int i = 0; ok && (i < (int)cards.size()); i++) {
                for (int j = i + 1; ok && (j < (int)cards.size()); j++) { ok = check(maskX, maskY, cards[i], cards[j]); }
            }
            if (ok) { ans = min(ans, bitcount(maskX) + bitcount(maskY)); }
        }
    }
    cout << ans << endl;
    return 0;
}

W4 Y1 W5 R4 W3 Y1 R4 W2 G3 G1 B5 Y5 Y2 Y3 G4 B5 W1 G5 Y5 Y3 G2 Y5 Y5 G5 R2 B3 B1 W5 Y1 W5 B4 W4 R4 B1 R1 W3 R5 R4 G2 W3 W3 R2 W5 Y2 B2 R3 R3 Y1 G5 G2 Y1 R4 Y5 W5 G5 B3 W2 R1 B2 W2 W2 Y5 W3 G1 B1 G2 Y3 W3 G1 W5 W1 G5 G2 Y1 W5 B5 W4 Y5 G2 R3 B4 R5 B1 R1 B4 Y4 Y4 Y3 R5 Y3 B3 W5 R5 Y5 G2 G5 W5 B4 G4 W5

B5 G3 Y2 W3 W1 G1 Y4 G3 G4 B5 W4 B5 Y3 R5 B4 G4 G4 B1 G1 R5 G4 B4 G1 G2 W1 Y4 R5 Y3 W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2 R2 R3 Y3 W5 W2 G4 R3 R3 W2 W5 Y4 R3 W2 R4 R2

Y3 Y3 Y3 Y3 Y3 Y3 W3 G3 G3 G3 W3 G3 G3 Y3 Y3 W3 G3 G3 Y3 W3 W3 Y3 Y3 G3 W3 W3 G3 Y3 Y3 W3 G3 W3 G3 W3 G3

W3 Y3 W3 W5 Y5 W3 W3 Y5 W3 W3 W3 W5 W3 Y3 Y5 Y3 Y5 Y3 W3 W3 W5 W5 W3 Y5 W3 W3 Y3 W3 W5 W3 Y3 Y3 Y5 Y5 Y3

Y3 R2 R2 Y2 Y5 Y4 B3 B3 Y4 W3 R1 W3 W5 B5 R1 Y4 B4 B5 B3 G3 B1 R2 R4 G5 Y5

W5 R1 Y3 G5 G3 G5 W2 Y1 R3 R4 B3 G5 G2 Y2 W1 G2 Y1 B4 Y2 G3 G3 Y4 W3 W5 Y2

Y1 W2 G3 W1 G1 G3 G4 W1 B2 W3 R4 B1 G2 Y4 G1 R2 R3 Y4 B2 G4 W2 Y2 R2 Y5 R4

B3 Y1 R3 Y3 R5 B4 B3 G1 R1 B4 B5 W3 R4 W1 B3 Y3 B3 Y4 B2 G5 Y1 G5 R4 B5 Y1

G4 R4 Y1 Y4 R3 B5 W2 G4 B5 B2 G1 B4 R4 G2 Y3 Y4 G5 Y3 R1 G2 Y5 G3 Y3 Y4 W3

R1 R3 G1 B5 Y5 W3 R4 R4 R1 G3 R2 W1 B1 G2 W2 G4 R2 W3 B1 W3 B5 Y5 R2 B4 B5

Y3 R4 G1 W1 R3 R2 W4 W1 R5 Y4 G3 R5 Y2 W1 Y1


[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]:
make constant ints N = 5e5 and inf = 1e9
create map m of chars to ints
create int n and int arrays tmp of size N, x of size N, and y of size N
declare Ok taking in int cur and returning bool
    for i = 0 to n exclusive
        set tmp[i] to 0
        set tmp[i] to tmp[i] | (1 << (x[i] - 1)) & cur
        set tmp[i] to tmp[i] | (1 << (y[i] - 1 + 5)) & cur
        for j = 0 to i exclusive
            if tmp[i] is equal to tmp[j] and if x[i] is not equal to x[j] or y[i] is not equal to y[j], return false
        end of the block
    end of the block
    return true
end of the block
define the main function
    set M['R'] to 1, M['G'] to 2, M['B'] to 3, M['Y'] to 4, and M['W'] to 5
    read n
    for i = 0 to n exclusive
        make string s
        read s
        set x[i] to M[s[0]]
        set y[i] to s[1] - '0'
    end of the block
    create integer res = 10
    for i = 0 to (1 << 10) exclusive
        make integer cur = _builtin_popcount(i)
        if cur is greater than or equal to res, continue loop
        if Ok(i) is truthy, set res to cur
    end of the block
    print res
    return to indicate successful execution
end of the block

[CODE]:

const int N = 5e5, inf = 1e9 + 7;
map<char, int> M;
int tmp[N], x[N], y[N], n;
bool Ok(int cur) {
    for (int i = 0; i < n; i++) {
        tmp[i] = 0;
        tmp[i] |= (1 << (x[i] - 1)) & cur;
        tmp[i] |= (1 << (y[i] - 1 + 5)) & cur;
        for (int j = 0; j < i; j++) {
            if (tmp[i] == tmp[j] && (x[i] != x[j] || y[i] != y[j])) return false;
        }
    }
    return true;
}
int main() {
    M['R'] = 1, M['G'] = 2, M['B'] = 3, M['Y'] = 4, M['W'] = 5;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        x[i] = M[s[0]];
        y[i] = s[1] - '0';
    }
    int res = 10;
    for (int i = 0; i < (1 << 10); i++) {
        int cur = __builtin_popcount(i);
        if (cur >= res) continue;
        if (Ok(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