[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 N = 100 + 5
create constant integer mod = 1000000000 + 7
bool function ok with char argument a
    if a is a letter character return 1
    if a is a capital letter character return 1
    if a is a digit return 1
    if a is '_' return 1
    return to indicate successful execution
end of the block
define the main function
    declare array of characters of size N
    read a + 1
    create integer len with value = length of (a + 1)
    set integer op to 1
    set boolean flag to 1
    integers cnt1 = 0, cnt2 = 0, ccnt = 0 and cnt3 = 0
    for integer i = 1 to len and flag inclusive
        if op is equal to 1
            increase cnt1
            if a[i] is '@'
                decrement cnt1
                set value of op to 2
                go to the start of the loop
            end of the block
            if ok(a[i]) is false, set flag to 0
            if cnt1 is greater than 16, set flag to 0
        else if op is equal to 2
            increment ccnt
            if cnt1 = 0 or cnt1 > 16, set flag to 0
            if a[i] is '.'
                if cnt2 = 0 or cnt2 > 16, set flag to 0
                set cnt2 to 0
                go to the start of the loop
            end of the block
            if a[i] is '/'
                decrement ccnt
                op = 3
                continue the loop
            end of the block
            if ok(a[i]) is false, set flag to 0
            increase cnt2
            if cnt2 is greater than 16, set flag to 0
        else
            if cnt2 = 0 or cnt2 is greater than 16, set flag to 0
            if ccnt = 0 or ccnt is greater than 32, set flag to 0
            if ok(a[i]) is false, set flag to 0
            increase cnt3
            if cnt3 is greater than 16, set flag to 0
        end of the block
    end of the block
    if op is equal to 1, set flag to 0
    if op = 2 and (cnt2 = 0 or cnt2 is greater than 16), set flag to 0
    if op = 3 and (cnt3 = 0 or cnt3 is greater than 16), set flag to 0
    if flag is true
        print "YES" and a new line
    else
        print "NO" and a new line
    return to indicate successful execution
end of the block

[CODE]:

const int N = 100 + 5;
const int mod = 1000000000 + 7;
bool ok(char a) {
    if (a >= 'a' && a <= 'z') return 1;
    if (a >= 'A' && a <= 'Z') return 1;
    if (a >= '0' && a <= '9') return 1;
    if (a == '_') return 1;
    return 0;
}
int main() {
    char a[N];
    cin >> a + 1;
    int len = strlen(a + 1);
    int op = 1;
    bool flag = 1;
    int cnt1 = 0, cnt2 = 0, ccnt = 0, cnt3 = 0;
    for (int i = 1; i <= len && flag; i++) {
        if (op == 1) {
            cnt1++;
            if (a[i] == '@') {
                cnt1--;
                op = 2;
                continue;
            }
            if (!ok(a[i])) { flag = 0; }
            if (cnt1 > 16) flag = 0;
        } else if (op == 2) {
            ccnt++;
            if (cnt1 == 0 || cnt1 > 16) flag = 0;
            if (a[i] == '.') {
                if (cnt2 == 0 || cnt2 > 16) flag = 0;
                cnt2 = 0;
                continue;
            }
            if (a[i] == '/') {
                ccnt--;
                op = 3;
                continue;
            }
            if (!ok(a[i])) { flag = 0; }
            cnt2++;
            if (cnt2 > 16) flag = 0;
        } else {
            if (cnt2 == 0 || cnt2 > 16) flag = 0;
            if (ccnt == 0 || ccnt > 32) flag = 0;
            if (!ok(a[i])) flag = 0;
            cnt3++;
            if (cnt3 > 16) flag = 0;
        }
    }
    if (op == 1) flag = 0;
    if (op == 2 && (cnt2 == 0 || cnt2 > 16)) flag = 0;
    if (op == 3 && (cnt3 == 0 || cnt3 > 16)) flag = 0;
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}