[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
    create ints i, j, flag = 1, and dot = 0
    let string ch
    read ch
    for i = 0 to length of ch exclusive
        if ch[i] is equal to '@'
            if i is greater than 16 or i is less than 1
                set flag to 0
                move to print
            end of the block
            break loop
        else if ch[i] is greater than or equal to 'a' and ch[i] is less than or equal to 'z' or if ch[i] is greater than or equal to 'A' and ch[i] is less than or equal to 'Z'
            continue to next loop
        else if ch[i] is greater than or equal to '0' and ch[i] is less than or equal to '9' and if ch[i] is equal to '_'
            continue to next loop iteration
        else
            set flag to 0
            go to print
        end of the block
    end of the block
identify dot
    for j = i + 1 to length of ch exclusive
        if ch[j] is equal to '.'
            if j - 1 is greater than 17 or j - i is less than 2
                set flag to 0
                go to print
            end of the block
            set i to j
        else if ch[j] is greater than or equal to 'a' and ch[j] is less than or equal to 'z' or if ch[j] is greater than or equal to 'A' and ch[j] is less than or equal to 'Z'
            continue to next loop
        else if ch[j] is greater than or equal to '0' and ch[j] is less than or equal to '9' or if ch[j] is equal to '_'
            continue to next loop
        else if ch[j] is equal to '/'
            if j - 1 is greater than 17 or j - i is less than 2
                set flag to 0
                go to print
            end of the block
            set i to j
        otherwise
            set flag to 0
            move to print
        end of the block
    end of the block
    if j - i is greater than 17 or j - i is less than 2, set flag to 0
identify print
    print "YES\n" if flag is truthy or "NO\n" if not
    return to indicate successful execution
end of the block

[CODE]:

int main() {
    int i, j, flag = 1, dot = 0;
    string ch;
    cin >> ch;
    for (i = 0; i < ch.length(); i++) {
        if (ch[i] == '@') {
            if (i > 16 || i < 1) {
                flag = 0;
                goto print;
            }
            break;
        } else if ((ch[i] >= 'a' && ch[i] <= 'z') || (ch[i] >= 'A' && ch[i] <= 'Z'))
            continue;
        else if ((ch[i] >= '0' && ch[i] <= '9') || (ch[i] == '_'))
            continue;
        else {
            flag = 0;
            goto print;
        }
    }
dot:
    for (j = i + 1; j < ch.length(); j++) {
        if (ch[j] == '.') {
            if (j - i > 17 || j - i < 2) {
                flag = 0;
                goto print;
            }
            i = j;
        } else if ((ch[j] >= 'a' && ch[j] <= 'z') || (ch[j] >= 'A' && ch[j] <= 'Z'))
            continue;
        else if ((ch[j] >= '0' && ch[j] <= '9') || (ch[j] == '_'))
            continue;
        else if (ch[j] == '/') {
            if (j - i > 17 || j - i < 2) {
                flag = 0;
                goto print;
            }
            i = j;
        } else {
            flag = 0;
            goto print;
        }
    }
    if (j - i > 17 || j - i < 2) flag = 0;
print:
    (flag) ? (cout << "YES\n") : (cout << "NO\n");
    return 0;
}