import java.io.*;
import java.util.*;
import java.util.regex.*;
class Main
{
static List<Pattern> patternList;
static List<Pattern> getPatterns()
{
if (patternList == null)
{
String[] regexes
= { "(a(?:b|c)a)",
"((?:a|b)ba)",
"(ab(?:a|c))" }; patternList = new ArrayList<Pattern>();
{
patternList.add(Pattern.compile(rgx));
}
}
return patternList;
}
{
Matcher m = Pattern.compile("dummy").matcher("dummy");
while ((s = r.readLine()) != null)
{
System.
out.
printf("%nInput: '%s'%n", s
); for (Pattern p : getPatterns())
{
m.reset(s).usePattern(p);
System.
out.
printf("%s : %b%n", p.
pattern(), m.
matches()); }
}
}
}
aW1wb3J0IGphdmEuaW8uKjsKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS51dGlsLnJlZ2V4Lio7CgpjbGFzcyBNYWluCnsKICBzdGF0aWMgTGlzdDxQYXR0ZXJuPiBwYXR0ZXJuTGlzdDsKICAKICBzdGF0aWMgTGlzdDxQYXR0ZXJuPiBnZXRQYXR0ZXJucygpCiAgewogICAgaWYgKHBhdHRlcm5MaXN0ID09IG51bGwpCiAgICB7CiAgICAgIFN0cmluZ1tdIHJlZ2V4ZXMgPSB7ICIoYSg/OmJ8YylhKSIsICIoKD86YXxiKWJhKSIsICIoYWIoPzphfGMpKSIgfTsKICAgICAgcGF0dGVybkxpc3QgPSBuZXcgQXJyYXlMaXN0PFBhdHRlcm4+KCk7CiAgICAgIGZvciAoU3RyaW5nIHJneCA6IHJlZ2V4ZXMpCiAgICAgIHsKICAgICAgICBwYXR0ZXJuTGlzdC5hZGQoUGF0dGVybi5jb21waWxlKHJneCkpOwogICAgICB9CiAgICB9CiAgICByZXR1cm4gcGF0dGVybkxpc3Q7CiAgfQoKCiAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBFeGNlcHRpb24KICB7CiAgICBNYXRjaGVyIG0gPSBQYXR0ZXJuLmNvbXBpbGUoImR1bW15IikubWF0Y2hlcigiZHVtb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