Help for this page
Select Code to Download
Select
or
download this
$string =~ s/(.)X+/$1 eq 'Y' ? YX : $1/eg;