[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 with N = 100 + 5
create contant integer mod with mod = 1000000000 + 7
declare boolean ok with character a as argument, returning boolean
    if a is greater than or equal to 'a' and a is less than or equal to 'z', return 1 from function
    if a is greater than or equal to 'A' and a is less than or equal to 'Z', return 1 from function
    if a is greater than or equal to '0' and a is less than or equal to '9', return 1 from function
    if a is '_', return 1 from function
    return to indicate successful execution
end of the block
define the main function
    create character array a with size N
    read a + 1
    create integer len with len = string length of (a + 1)
    create integer op with op = 1
    create boolean flag with flag = 1
    create integers cnt1, cnt2, ccnt, cnt3, with cnt1 = 0, cnt2 = 0, ccnt = 0, cnt3 = 0
    for i = 1 to len and flag inclusive
        if op is 1
            increment cnt1
            if a[i] is '@'
                decrement cnt1
                set op to 2
                break current loop iteration
            end of the block
            if result of run ok with a[i] as argument is false, set flag to 0
            if cnt1 is greater than 16, set flag to 0
        else if op is 2
            increment ccnt
            if cnt is 0 or cnt1 is greater than 16, set flag to 0
            if a[i] is '.'
                if cnt2 is 0 or cnt2 is greater than 16, set flag to 0
                set cnt2 to 0
                break current loop iteration
            end of the block
            if a[i] is '/'
                decrement ccnt
                set op to 3
                break current loop iteration
            end of the block
            if result of run ok with a[i] as argument is false, set flag to 0
            increment cnt2
            if cnt2 is greater than 16, set flag to 0
        else
            if cnt2 is 0 or cnt2 is greater than 16, set flag to 0
            if ccnt is 0 or ccnt is greater than 32, set flag to 0
            if result of run ok with a[i] as argument is false, set flag to 0
            increment cnt3
            if cnt3 is greater than 16, set flag to 0
        end of the block
    end of the block
    if op is 1, set flag to 0
    if op is 2 and ( cnt2 is 0 or cnt2 is greater than 16 ), set flag to 0
    if op is 3 and ( cnt3 is 0 or cnt3 is greater than 16 ), set flag to 0
    if flag is true
        print "YES" print newline
    else
        print "NO" print newline
    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;
}