/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.Pattern;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
private static final Pattern BITS = Pattern.compile("^(?=(1*01*0)*1*$)(?=(0*10*1)*0*$).*$");
public static final boolean evenBitCounts
(String value
) { return BITS.matcher(value).matches();
}
public static void main
(String[] args
) { "01010101",
"",
"11",
"00",
"01",
"111",
"11110",
"1111",
"0000",
"0 11"
};
System.
out.
printf("Test: %s -> %s\n", t, evenBitCounts
(t
)); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwucmVnZXguUGF0dGVybjsKCgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKICAgIHByaXZhdGUgc3RhdGljIGZpbmFsIFBhdHRlcm4gQklUUyA9IFBhdHRlcm4uY29tcGlsZSgiXig/PSgxKjAxKjApKjEqJCkoPz0oMCoxMCoxKSowKiQpLiokIik7CiAgICAKICAgIHB1YmxpYyBzdGF0aWMgZmluYWwgYm9vbGVhbiBldmVuQml0Q291bnRzKFN0cmluZyB2YWx1ZSkgewogICAgICAgIHJldHVybiBCSVRTLm1hdGNoZXIodmFsdWUpLm1hdGNoZXMoKTsKICAgIH0KICAgIAogICAgCiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB7CiAgICAgICAgU3RyaW5nW10gaW5wdXRzID0gewogICAgICAgICAgICAgICAgIjAxMDEwMTAxIiwKICAgICAgICAgICAgICAgICIiLAogICAgICAgICAgICAgICAgIjExIiwKICAgICAgICAgICAgICAgICIwMCIsCiAgICAgICAgICAgICAgICAiMDEiLAogICAgICAgICAgICAgICAgIjExMSIsCiAgICAgICAgICAgICAgICAiMTExMTAiLAogICAgICAgICAgICAgICAgIjExMTEiLAogICAgICAgICAgICAgICAgIjAwMDAiLAogICAgICAgICAgICAgICAgIjAgMTEiCiAgICAgICAgICAgICAgICAKICAgICAgICB9OwogICAgICAgIGZvciAoU3RyaW5nIHQgOiBpbnB1dHMpIHsKICAgICAgICAgICAgU3lzdGVtLm91dC5wcmludGYoIlRlc3Q6ICVzIC0+ICVzXG4iLCB0LCBldmVuQml0Q291bnRzKHQpKTsKICAgICAgICB9CiAgICB9Cn0=