# Special quines and code golf, hooray!

Make a quine. Simple enough, except it has to be a palindrome and accept input.

Now, any side of a palindromic quine is one half of it. For example, one side of the hypothetical quine AAAA is AA. One side of AAAAA is AA (the center symbol is ignored).

Your job is to make a quine like this that accepts input. If the input is the whole quine, then the quine prints the left side of itself. If the input is either side of the quine then the quine prints itself. Of course, with quines with an odd number of symbols the center symbol is ignored. If the input is anything other than the cases specified, the program must do nothing.

This is code golf, so the shortest submission wins.

• It can be the right side, the left side or the quine itself. If anything else is inputted the program must do nothing. Nov 25 '18 at 9:31
• @l4m2 From the spec it would need to print ; if the input is empty, so if ; is a nop it wouldn't be valid as far as I see. Nov 25 '18 at 14:46
• yee. the program must print nothing. Nov 25 '18 at 15:24

main=interact f;f s|s==l++r=l|s/=l,s/=r=[]|1<3=l++r;r=reverse l;l=q++shows q['-'];q="main=interact f;f s|s==l++r=l|s/=l,s/=r=[]|1<3=l++r;r=reverse l;l=q++shows q['-'];q="--"=q;]'-'[q swohs++q=l;l esrever=r;r++l=3<1|][=r=/s,l=/s|l=r++l==s|s f;f tcaretni=niam"=q;]'-'[q swohs++q=l;l esrever=r;r++l=3<1|][=r=/s,l=/s|l=r++l==s|s f;f tcaretni=niam


Edit: -8 bytes thanks to Ørjan Johansen! Also changed to a version which does not need (<>).

• Save 4 bytes by rearranging guards to turn || into ,. (I also tried several ways to turn (++['-']) into something simpler like ('-':), including switching l and r, but it hasn't worked.) Nov 26 '18 at 4:00
• @ØrjanJohansen Thanks! Nov 26 '18 at 17:47
• the legend orjan johansen has appeared to help this man in his quest. Nov 26 '18 at 18:15
• With your new version, you can save 4 more with shows. Nov 27 '18 at 1:34

# Javascript, 224 200 bytes

Prompts for input. I shaved off some bytes by using ES6 features. Still can probably be golfed a lot more.

(f=_=>{a=prompt();s=(f=${f})()/;r=[...s].reverse().join('');return a==s||a==r?s+r:a==s+r?s:""})()//)()}"":s?r+s==a:r+s?r==a||s==a nruter;)''(nioj.)(esrever.]s...[=r;/)()}f{$=f(=s;)(tpmorp=a{>=_=f(