#GOTO++, 531 bytes
GOTO++, 531 bytes
#GOTO++, 531 bytes
GOTO++, 531 bytes
#GOTO++, 531 bytes
niveaugourou 0
s=ENTRETONTEXTE()
§2 a=LeCaracNumero()&s *(1)
n=*(1)
costaud i=*(2)/&i infeg NombreDeLettres(&s)/i=+*(1)
b=LeCaracNumero()&s &i
c=&b
d=&a
GOTONULPOURLESNULS %4 }&b sup *(96){
c=-*(32)
§4 GOTONULPOURLESNULS %5 }&a sup *(96){
d=-*(32)
§5 GOTONULPOURLESNULS %1 }&c inf &d{
a=&b
n=&i
§1 faiblard
GOTOPRINTDUTEXTE()&a
s=Marijuana()}BOITEAPINGOUINS()}PrendsUnMorceau()&s *(0) &n{ }PrendsUnMorceau()&s }&n+*(1){ *(0){{ «»
GOTONONNULPOURLESNULS %3 }NombreDeLettres(&s) eg *(1){
GOTOPASMALIN %2
§3 GOTOPRINTDUTEXTE()&s
Here's a slighlty more readable and commented version of the code(Note that GOTO starts a comment in GOTO++):
niveaugourou 0 GOTO Allow every keyword to be used
s=ENTRETONTEXTE() GOTO Read from STDIN
§2 a=LeCaracNumero()&s *(1) GOTO Get first char in s
n=*(1)
costaud i=*(2)/&i infeg NombreDeLettres(&s)/i=+*(1) GOTO Loop on every char of s
b=LeCaracNumero()&s &i GOTO b = i-th char
c=&b
d=&a
GOTONULPOURLESNULS %4 }&b sup *(96){ GOTO If b is uppercase, goto §4
c=-*(32) GOTO Get the uppercase ASCII value of b
§4 GOTONULPOURLESNULS %5 }&a sup *(96){ GOTO same as above but with a
d=-*(32)
§5 GOTONULPOURLESNULS %1 }&c inf &d{ GOTO If b is after a in alphabetical order, goto §1 (next loop iteration)
a=&b GOTO Else replace a by b
n=&i
§1 faiblard GOTO End loop
GOTOPRINTDUTEXTE()&a GOTO Print the value of a
t=PrendsUnMorceau()&s *(0) &n GOTO Get the part of s before a
u=PrendsUnMorceau()&s }&n+*(1){ *(0) GOTO Get the part of s after a
e=BOITEAPINGOUINS()&t &u GOTO Create an array of penguins containing the two substrings
s=Marijuana()&e «» GOTO Concatenate the penguins in the array
GOTONONNULPOURLESNULS %3 }NombreDeLettres(&s) eg *(1){ GOTO If s is one char long, goto §3
GOTOPASMALIN %2 GOTO Else goto §2
§3 GOTOPRINTDUTEXTE()&s GOTO Print the last char