Enter a string, determine whether it is legitimate mail (to the correct format, regardless of whether there really) input only letters, numbers, underscores, and @. Five, at around @ only letters or numbers, and. after only com, is output YES, otherwise output NO.
Input formats:
A string of characters.
Output formats:
For each input, output YES or NO.
Sample input:
Sample output:
YES
1 #include<iostream> 2 #include<string> 3 #include<regex> 4 using namespace std; 5 int main() 6 { 7 string s; 8 cin >> s; 9 regex r("[a-zA-Z0-9\_]+@[a-zA-Z0-9]+(\.(com))"); 10 if (regex_match(s, r)) 11 cout << "YES"; 12 else 13 cout << "NO"; 14 return 0; 15 }