Vyxal D
, 7373 51 bytes
`#:tpq`#Ėß₂:⌈t+…ṘQ,Q ḢDD₂[ĖĖ|##`ḢDD₂[ĖĖ|##`
`#…+ṘẎ7:tpqṘq`Ṙ:⌈t+…₂ßĖ#`
`#Ėß₂:ṘQ,Q ḢDD₂[ĖĖ|##`ḢDD₂[ĖĖ|##`…+ṘẎ7:Ṙq`Ṙ:₂ßĖ#`
Explanation :
`#:tpq`#Ėß₂:⌈t+…ṘQ,Q ḢDD₂[ĖĖ|##` …+ṘẎ7:Ṙq` # push thethis string to the stack
Ḣ Ṙ: # removereverse the first char
DD string and #push createa somecopy copies
₂ßĖ ₂[ĖĖ| # execute the #top if length%2the ,length executeis twiceeven
# EXECUTION at this point the stack is [ qṘ:7ẎṘ+…,QṘ:₂ßĖ# ]
Ṙq ##` # comment
:tp quote and revert => [ `#Ėß₂:ṘQ,…+ṘẎ7:Ṙq` ]
Ẏ7: # prependget the lat char
7 qfirst char => [ `#Ėß₂:ṘQ,…+ṘẎ7:Ṙq` , `#Ėß₂:Ṙ ]
+Ṙ # quote
revert and add => [`#Ėß₂:⌈t+ ṘQ,…+ṘẎ7:Ṙq`Ṙ:₂ßĖ#`]
Q,… # split and add theprint, lastreprint partand (ḢDD₂[ĖĖ|##`)quit
#Ėß₂:Ṙ …,Q # does nothing since the program ended
# print, re-printEND andOF quitEXECUTION
ḢDD₂[ĖĖ|## #` # do nothing herecomment
Whenever aWhen any char is removed fromof the string or Ḣ
is removed, its length is even anymore so the code goes to the second line which is unchanged (sice₂ß
prevents the detetion already occured)execution
if a
``
is removed, no code of the line will execute because the line will be either comented, either one single string either a mix of both and no execute fireif
₂
is removed, the code will execute normally (as the deletion is not in the string)if any of
Ṙ:ßĖ
is removed, the code will be either equal to0
,1
, a commented code or there will be no execution. This has no incidence and the code will executein the second line
If ``` is removed anywhere onIn any case the first line, no code will execute and the second line will execute normally
if any of ₂[
is removed,either have the first string is therefore untuched anduntouched or a string without incidence, in wich case, the code willsecond execute as intendedwill have the string untouched.
The doubled char DD
, ĖĖ
and ##
are here to enureprogram ends at the function willfirst sucessful execute even if one of the charsince there is removeda quit instruction in the string