import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Locale;
public class Main {
public static void main
(String[] args
) { DateTimeFormatter dtf = new DateTimeFormatterBuilder()
.parseCaseInsensitive()
.appendPattern("MMM/uuuu")
String currentMonth
= "SEP/2021";
YearMonth currentYm = YearMonth.parse(currentMonth, dtf);
YearMonth previousYm = currentYm.minusMonths(1);
String previousMonth
= previousYm.
format(dtf
); System.
out.
println(previousMonth
);
// If required, convert it into the UPPER CASE
System.
out.
println(previousMonth.
toUpperCase()); }
}
aW1wb3J0IGphdmEudGltZS5ZZWFyTW9udGg7CmltcG9ydCBqYXZhLnRpbWUuZm9ybWF0LkRhdGVUaW1lRm9ybWF0dGVyOwppbXBvcnQgamF2YS50aW1lLmZvcm1hdC5EYXRlVGltZUZvcm1hdHRlckJ1aWxkZXI7CmltcG9ydCBqYXZhLnV0aWwuTG9jYWxlOwoKcHVibGljIGNsYXNzIE1haW4gewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewoJCURhdGVUaW1lRm9ybWF0dGVyIGR0ZiA9IG5ldyBEYXRlVGltZUZvcm1hdHRlckJ1aWxkZXIoKQoJCQkJCQkJCS5wYXJzZUNhc2VJbnNlbnNpdGl2ZSgpCgkJCQkJCQkJLmFwcGVuZFBhdHRlcm4oIk1NTS91dXV1IikKCQkJCQkJCQkudG9Gb3JtYXR0ZXIoTG9jYWxlLlJPT1QpOwoKCQlTdHJpbmcgY3VycmVudE1vbnRoID0gIlNFUC8yMDIxIjsKCgkJWWVhck1vbnRoIGN1cnJlbnRZbSA9IFllYXJNb250aC5wYXJzZShjdXJyZW50TW9udGgsIGR0Zik7CgkJWWVhck1vbnRoIHByZXZpb3VzWW0gPSBjdXJyZW50WW0ubWludXNNb250aHMoMSk7CgoJCVN0cmluZyBwcmV2aW91c01vbnRoID0gcHJldmlvdXNZbS5mb3JtYXQoZHRmKTsKCQlTeXN0ZW0ub3V0LnByaW50bG4ocHJldmlvdXNNb250aCk7CgoJCS8vIElmIHJlcXVpcmVkLCBjb252ZXJ0IGl0IGludG8gdGhlIFVQUEVSIENBU0UKCQlTeXN0ZW0ub3V0LnByaW50bG4ocHJldmlvdXNNb250aC50b1VwcGVyQ2FzZSgpKTsKCX0KfQ==