import java.util.*;
import java.util.regex.*;
import java.lang.*;
import java.io.*;
class Ideone
{
{
String[] arrayOfLine
= {"I.2 Other Interpretive Provisions" ,
"I.3 Accounting Terms",
"Including all",
"II.1 The Loans",
"II.3 Prepayments.",
"III.2 Illegality",
"IV.2 Conditions",
"V.2 Authorization",
"expected to have"}; Pattern pat = Pattern.compile("^[A-Z]+\\.[0-9]+\\b");
List<String> listOfHeadings = new ArrayList<>();
for (String s
: arrayOfLine
) { Matcher m = pat.matcher(s);
if (m.find()) {
listOfHeadings.add(s);
}
}
System.
out.
println(listOfHeadings
);
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS51dGlsLnJlZ2V4Lio7CmltcG9ydCBqYXZhLmxhbmcuKjsKaW1wb3J0IGphdmEuaW8uKjsKY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN0cmluZ1tdIGFycmF5T2ZMaW5lID0geyJJLjIgT3RoZXIgSW50ZXJwcmV0aXZlIFByb3Zpc2lvbnMiICwgIkkuMyBBY2NvdW50aW5nIFRlcm1zIiwiSW5jbHVkaW5nIGFsbCIsIklJLjEgVGhlIExvYW5zIiwiSUkuMyBQcmVwYXltZW50cy4iLCJJSUkuMiBJbGxlZ2FsaXR5IiwiSVYuMiBDb25kaXRpb25zIiwiVi4yIEF1dGhvcml6YXRpb24iLCJleHBlY3RlZCB0byBoYXZlIn07CgkJUGF0dGVybiBwYXQgPSBQYXR0ZXJuLmNvbXBpbGUoIl5bQS1aXStcXC5bMC05XStcXGIiKTsKCQlMaXN0PFN0cmluZz4gbGlzdE9mSGVhZGluZ3MgPSBuZXcgQXJyYXlMaXN0PD4oKTsKICAgIAlmb3IgKFN0cmluZyBzIDogYXJyYXlPZkxpbmUpIHsKICAgIAkJTWF0Y2hlciBtID0gcGF0Lm1hdGNoZXIocyk7CiAgICAJCWlmIChtLmZpbmQoKSkgewogICAgICAgICAgIAkJbGlzdE9mSGVhZGluZ3MuYWRkKHMpOwogICAgCQl9CgkJfQoJCVN5c3RlbS5vdXQucHJpbnRsbihsaXN0T2ZIZWFkaW5ncyk7CgoJfQp9