fork(1) download
  1. import java.util.Scanner;
  2. import java.util.regex.Matcher;
  3. import java.util.regex.Pattern;
  4.  
  5. class A_JabberID {
  6. public static void main(String[] args) throws Exception {
  7. String str = new Scanner(System.in).nextLine();
  8. String r1 = "[\\w]{1,16}@([\\w\\.]{1,32})(/[\\w]{1,16}){0,1}";
  9. Matcher m = Pattern.compile(r1).matcher(str);
  10. if (m.matches() && m.group(1).matches("^[\\w]{1,16}(\\.[\\w]{1,16})*")) {
  11. System.out.println("YES");
  12. } else {
  13. System.out.println("NO");
  14. }
  15. }
  16. }
  17.  
Success #stdin #stdout 0.06s 213440KB
stdin
mike@codeforces.com
stdout
YES