public class Main {
public static void main
(String[] args
) { // Declara și inițializează variabilele
String variabila2
= "OCTOMBRIE";
// Concatenare cu spațiu între ele
String rezultat1
= variabila1
+ " " + variabila2
;
// Preluarea majusculei primului caracter din prima variabilă și
// a minusculei ultimului caracter din a doua variabilă
char primaMajuscula
= Character.
toUpperCase(variabila1.
charAt(0)); char ultimaMinuscula
= Character.
toLowerCase(variabila2.
charAt(variabila2.
length() - 1));
// Formarea rezultatului cu caracterele între '*'
String rezultat2
= "*" + primaMajuscula
+ ultimaMinuscula
+ "*";
// Afișează rezultatele
System.
out.
println("Rezultat 1: " + rezultat1
); System.
out.
println("Rezultat 2: " + rezultat2
); }
}
cHVibGljIGNsYXNzIE1haW4gewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIC8vIERlY2xhcmEgyJlpIGluacibaWFsaXplYXrEgyB2YXJpYWJpbGVsZQogICAgICAgIFN0cmluZyB2YXJpYWJpbGExID0gInRvYW1uYSI7CiAgICAgICAgU3RyaW5nIHZhcmlhYmlsYTIgPSAiT0NUT01CUklFIjsKICAgICAgICAKICAgICAgICAvLyBDb25jYXRlbmFyZSBjdSBzcGHIm2l1IMOubnRyZSBlbGUKICAgICAgICBTdHJpbmcgcmV6dWx0YXQxID0gdmFyaWFiaWxhMSArICIgIiArIHZhcmlhYmlsYTI7CiAgICAgICAgCiAgICAgICAgLy8gUHJlbHVhcmVhIG1hanVzY3VsZWkgcHJpbXVsdWkgY2FyYWN0ZXIgZGluIHByaW1hIHZhcmlhYmlsxIMgyJlpCiAgICAgICAgLy8gYSBtaW51c2N1bGVpIHVsdGltdWx1aSBjYXJhY3RlciBkaW4gYSBkb3VhIHZhcmlhYmlsxIMKICAgICAgICBjaGFyIHByaW1hTWFqdXNjdWxhID0gQ2hhcmFjdGVyLnRvVXBwZXJDYXNlKHZhcmlhYmlsYTEuY2hhckF0KDApKTsKICAgICAgICBjaGFyIHVsdGltYU1pbnVzY3VsYSA9I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