Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS_
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <cmath>
- #include <string>
- #define sz(a) int(a.size())
- #define all(a) a.begin(), a.end()
- #define fore(i, l, r) for(int i = int(l); i < int(r); i++)
- #define forn(i, n) fore(i, 0, n)
- #define pb push_back
- #define x first
- #define y second
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- #ifdef _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- string s;
- cin >> s;
- string s1 = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_";
- int j = 0;
- int cnt = 0;
- while (s[j] != '@') {
- if (s1.find(s[j]) != -1) {
- cnt++;
- if (cnt > 16) {
- cout << "NO";
- return 0;
- }
- }
- else {
- cout << "NO";
- return 0;
- }
- j++;
- }
- if (s[sz(s) - 1] == '@') {
- cout << "NO";
- return 0;
- }
- if (cnt == 0) {
- cout << "NO";
- return 0;
- }
- int ind = j + 1;
- cnt = 0;
- bool f = 0;
- int k = 0;
- int cl = 0;
- int toc = 0;
- bool w = 1;
- fore(i,ind,sz(s)) {
- if (s[i] != '.') {
- if (s[i] == '/') {
- f = 1;
- ind = i;
- break;
- }
- else {
- if (s1.find(s[i]) != -1) {
- cnt++;
- if (cnt > 16) {
- cout << "NO";
- return 0;
- }
- }
- else {
- cout << "NO";
- return 0;
- }
- }
- }
- else {
- w = 0;
- if (s[i] == '.' && s[i + 1] == '.') {
- cout << "NO";
- return 0;
- }
- toc++;
- cl ++;
- k += cnt;
- cnt = 0;
- if (k > 32 || k < 1) {
- cout << "NO";
- return 0;
- }
- }
- }
- if (f == 1) {
- if (s[ind - 1] == '.') {
- }
- else {
- cl++;
- }
- } else {
- if (s[sz(s) - 1] == '.') {
- }
- else {
- cl++;
- }
- }
- if (w == 1 && cnt > 1) {
- }
- else {
- if (toc >= cl) {
- cout << "NO";
- return 0;
- }
- }
- if (cl < 1) {
- cout << "NO";
- return 0;
- }
- if (f == 1) {
- cnt = 0;
- fore(i,ind + 1,sz(s)) {
- if (s1.find(s[i]) != -1) {
- cnt++;
- if (cnt > 16) {
- cout << "NO";
- return 0;
- }
- }
- else {
- cout << "NO";
- return 0;
- }
- }
- if (cnt > 1) {
- cout << "YES";
- }
- else cout << "NO";
- } else {
- cout << "YES";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement