/* package whatever; // don't place package name! */
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
Pattern pat = Pattern.compile( "^(?!.*__)(?=[A-Za-z])[a-z A-Z0-9_]+(?<![ _])$" );
for ( int i=0; i<100; i++ ) {
long t1
= System.
currentTimeMillis();
test(text, pat);
long t2
= System.
currentTimeMillis(); System.
out.
println( t2
- t1
) ; }
}
public static boolean test
(String text, Pattern p
) { boolean b = false;
for ( int i=0; i<400000; i++ ) {
b = match(text, p);
}
return b;
}
public static boolean match
(String text, Pattern p
) { Matcher m = p.matcher( text );
return m.matches();
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwppbXBvcnQgamF2YS51dGlsLnJlZ2V4LlBhdHRlcm47CmltcG9ydCBqYXZhLnV0aWwucmVnZXguTWF0Y2hlcjsKaW1wb3J0IGphdmEubGFuZy4qOwppbXBvcnQgamF2YS5pby4qOwogCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJUGF0dGVybiBwYXQgPSBQYXR0ZXJuLmNvbXBpbGUoICJeKD8hLipfXykoPz1bQS1aYS16XSlbYS16IEEtWjAtOV9dKyg/PCFbIF9dKSQiICk7CgkJU3RyaW5nIHRleHQgPSAiYyAgICAgICAgICAgICBhICAgICAgICAgICAgICAgICAgICAgIGIgICAgICAgICAgICAgICAgICAgICAgZCI7CgkJZm9yICggaW50IGk9MDsgaTwxMDA7IGkrKyApIHsKCQkJbG9uZyB0MSA9IFN5c3RlbS5jdXJyZW50VGltZU1pbGxpcyg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