import java.util.regex.*;
class Main
{
{
String s
= "hello 'cool1' word! 'cool2'"; Pattern pattern = Pattern.compile("'([^']*)'");
Matcher matcher = pattern.matcher(s);
if (matcher.find()) {
System.
out.
println(matcher.
group(1)); }
}
}
aW1wb3J0IGphdmEudXRpbC5yZWdleC4qOwoKY2xhc3MgTWFpbgp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmcgcyA9ICJoZWxsbyAnY29vbDEnIHdvcmQhICdjb29sMiciOwoJCVBhdHRlcm4gcGF0dGVybiA9IFBhdHRlcm4uY29tcGlsZSgiJyhbXiddKiknIik7CgkJTWF0Y2hlciBtYXRjaGVyID0gcGF0dGVybi5tYXRjaGVyKHMpOwoJCWlmIChtYXRjaGVyLmZpbmQoKSkgewoJCQlTeXN0ZW0ub3V0LnByaW50bG4obWF0Y2hlci5ncm91cCgxKSk7CgkJfQoJfQp9