/* package whatever; // don't place package name! */
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
{
{
final String regex
= "(?<=^(?:.{3}|.{4}|.{5}))."; final String string
= "AD-BJR5U";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
// The substituted value will be contained in the result variable
final String result
= matcher.
replaceAll(subst
);
System.
out.
println("Substitution result: " + result
); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwucmVnZXguTWF0Y2hlcjsKaW1wb3J0IGphdmEudXRpbC5yZWdleC5QYXR0ZXJuOwoKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlmaW5hbCBTdHJpbmcgcmVnZXggPSAiKD88PV4oPzouezN9fC57NH18Lns1fSkpLiI7CgkJZmluYWwgU3RyaW5nIHN0cmluZyA9ICJBRC1CSlI1VSI7CgkJZmluYWwgU3RyaW5nIHN1YnN0ID0gIioiOwoJCQoJCWZpbmFsIFBhdHRlcm4gcGF0dGVybiA9IFBhdHRlcm4uY29tcGlsZShyZWdleCk7CgkJZmluYWwgTWF0Y2hlciBtYXRjaGVyID0gcGF0dGVybi5tYXRjaGVyKHN0cmluZyk7CgkJCgkJLy8gVGhlIHN1YnN0aXR1dGVkIHZhbHVlIHdpbGwgYmUgY29udGFpbmVkIGluIHRoZSByZXN1bHQgdmFyaWFibGUKCQlmaW5hbCBTdHJpbmcgcmVzdWx0ID0gbWF0Y2hlci5yZXBsYWNlQWxsKHN1YnN0KTsKCQkKCQlTeXN0ZW0ub3V0LnByaW50bG4oIlN1YnN0aXR1dGlvbiByZXN1bHQ6ICIgKyByZXN1bHQpOwoJfQp9