import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String regex
= "tree[0-9][a-z]?"; + "tree2\n"
+ "tree1a\n"
+ "tree1b\n"
+ "tree2a\n"
+ "tree2b\n"
+ "atree1\n"
+ "tree20\n"
+ "tree2ab";
Pattern patternSet = Pattern.compile("^tree[0-9][a-z]?$", Pattern.MULTILINE);
Matcher matcher = patternSet.matcher(string);
while (matcher.find()) {
System.
out.
println(matcher.
group(0)); }
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwucmVnZXguTWF0Y2hlcjsKaW1wb3J0IGphdmEudXRpbC5yZWdleC5QYXR0ZXJuOwoKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmcgcmVnZXggPSAidHJlZVswLTldW2Etel0/IjsKCQlTdHJpbmcgc3RyaW5nID0gInRyZWUxXG4iCgkJICsgInRyZWUyXG4iCgkJICsgInRyZWUxYVxuIgoJCSArICJ0cmVlMWJcbiIKCQkgKyAidHJlZTJhXG4iCgkJICsgInRyZWUyYlxuIgoJCSArICJhdHJlZTFcbiIKCQkgKyAidHJlZTIwXG4iCgkJICsgInRyZWUyYWIiOwoJCQoJCVBhdHRlcm4gcGF0dGVyblNldCA9IFBhdHRlcm4uY29tcGlsZSgiXnRyZWVbMC05XVthLXpdPyQiLCBQYXR0ZXJuLk1VTFRJTElORSk7CgkJTWF0Y2hlciBtYXRjaGVyID0gcGF0dGVyblNldC5tYXRjaGVyKHN0cmluZyk7CgkJCgkJd2hpbGUgKG1hdGNoZXIuZmluZCgpKSB7CgkJICAgIFN5c3RlbS5vdXQucHJpbnRsbihtYXRjaGVyLmdyb3VwKDApKTsKCQl9Cgl9Cn0=