Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS_
  2.  
  3. #include <iostream>
  4. #include <algorithm>
  5. #include <vector>
  6. #include <cmath>
  7. #include <string>
  8.  
  9. #define sz(a) int(a.size())
  10. #define all(a) a.begin(), a.end()
  11. #define fore(i, l, r) for(int i = int(l); i < int(r); i++)
  12. #define forn(i, n) fore(i, 0, n)
  13. #define pb push_back
  14. #define x first
  15. #define y second
  16.  
  17.  
  18. using namespace std;
  19.  
  20.  
  21. int main() {
  22. ios_base::sync_with_stdio(0);
  23. cin.tie(0);
  24. #ifdef _DEBUG
  25. freopen("input.txt", "r", stdin);
  26. freopen("output.txt", "w", stdout);
  27. #endif
  28. string s;
  29. cin >> s;
  30. string s1 = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_";
  31. int j = 0;
  32. int cnt = 0;
  33. while (s[j] != '@') {
  34. if (s1.find(s[j]) != -1) {
  35. cnt++;
  36. if (cnt > 16) {
  37. cout << "NO";
  38. return 0;
  39. }
  40. }
  41. else {
  42. cout << "NO";
  43. return 0;
  44. }
  45. j++;
  46. }
  47. if (s[sz(s) - 1] == '@') {
  48. cout << "NO";
  49. return 0;
  50. }
  51. if (cnt == 0) {
  52. cout << "NO";
  53. return 0;
  54. }
  55. int ind = j + 1;
  56. cnt = 0;
  57. bool f = 0;
  58. int k = 0;
  59. int cl = 0;
  60. int toc = 0;
  61. bool w = 1;
  62. fore(i,ind,sz(s)) {
  63. if (s[i] != '.') {
  64. if (s[i] == '/') {
  65. f = 1;
  66. ind = i;
  67. break;
  68. }
  69. else {
  70. if (s1.find(s[i]) != -1) {
  71. cnt++;
  72. if (cnt > 16) {
  73. cout << "NO";
  74. return 0;
  75. }
  76. }
  77. else {
  78. cout << "NO";
  79. return 0;
  80. }
  81. }
  82. }
  83. else {
  84. w = 0;
  85. if (s[i] == '.' && s[i + 1] == '.') {
  86. cout << "NO";
  87. return 0;
  88. }
  89. toc++;
  90. cl ++;
  91. k += cnt;
  92. cnt = 0;
  93. if (k > 32 || k < 1) {
  94. cout << "NO";
  95. return 0;
  96. }
  97. }
  98. }
  99. if (f == 1) {
  100. if (s[ind - 1] == '.') {
  101.  
  102. }
  103. else {
  104. cl++;
  105. }
  106. } else {
  107. if (s[sz(s) - 1] == '.') {
  108.  
  109. }
  110. else {
  111. cl++;
  112. }
  113. }
  114. if (w == 1 && cnt > 1) {
  115.  
  116. }
  117. else {
  118. if (toc >= cl) {
  119. cout << "NO";
  120. return 0;
  121. }
  122. }
  123. if (cl < 1) {
  124. cout << "NO";
  125. return 0;
  126. }
  127. if (f == 1) {
  128. cnt = 0;
  129. fore(i,ind + 1,sz(s)) {
  130. if (s1.find(s[i]) != -1) {
  131. cnt++;
  132. if (cnt > 16) {
  133. cout << "NO";
  134. return 0;
  135. }
  136. }
  137. else {
  138. cout << "NO";
  139. return 0;
  140. }
  141. }
  142. if (cnt > 1) {
  143. cout << "YES";
  144. }
  145. else cout << "NO";
  146.  
  147. } else {
  148. cout << "YES";
  149. }
  150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement