[Question]
  [
This is a mirror: `|`. I just found out that you can stick a mirror in the middle of a string if the string can be mirrored on itself! For example, the string `abccba`. If you cut it in half the two halves are mirror images of each other:
```
abc  <-->  cba
```
So, we can stick a mirror in the middle of the string, and our new string is `abc|cba`. Sometimes, only part of the string can be mirrored on itself. For example, the string "mirror". The two r's are mirrored, but the rest of the string isn't. That's OK, we'll just remove the parts of the string that don't mirror each other, and we get the following string:
```
r|r
```
Some strings could be mirrored in multiple places. For example, "Hello World, xyzzyx". I like having a lot of text reflected in my mirror, so you need to find the best place to put my mirror. In this case, you should output the longer mirrored string and just like our last example, remove everything else. This string becomes:
```
xyz|zyx
```
Some strings *look* like they can be mirrored, but actually can not. If a string cannot be mirrored anywhere, you should output nothing.
# The challenge:
Given a string containing only printable-ascii, find the best place to put my mirror. In other words,
> 
> Find the largest even-length palindromic substring, then output it with a pipe character '|' in the middle of it.
> 
> 
> 
The input will be 1-50 characters long.
You can assume that the input will not contain mirrors `|` or newlines. Beyond that, all printable-ascii characters are fair game. If the longest mirrored substring is tied between two substrings, you can choose which one to output. For example, for the string "abba ollo", you must output "ab|ba" or "ol|lo", but it doesn't matter which one you output. Strings are case-sensitive, e.g. "ABba" should *not* output "AB|ba", it should output the empty string.
# Sample IO:
```
"Hello World"     --> "l|l"
"Programming Puzzles and Code-Golf"     --> Either "m|m" or "z|z"
"abcba"           --> ""
"Hulluh"          --> "ul|lu"
"abcdefggfedcba"  --> "abcdefg|gfedcba"
"abcdefggfabc"    --> "fg|gf"
"AbbA"            --> "Ab|bA"
"This input is a lot like the last one, but with more characters that don't change the output. AbbA" --> "Ab|bA"
```
As usual, this is code-golf, so standard loopholes apply, and the shortest answer in bytes wins!
  
[Answer]
# Pyth - ~~19~~ ~~17~~ ~~15~~ 13 bytes
*Thanks to @FryAmTheEggman for saving me two bytes.*
~~ARRGH the special case for no answer.~~ Solved that!
```
e_I#jL\|cL2.:
```
[Test Suite](http://pyth.herokuapp.com/?code=e_I%23jL%5C%7CcL2.%3A&test_suite=1&test_suite_input=%22Hello+World%22+++++%0A%22Programming+Puzzles+and+Code-Golf%22+++++%0A%22abcba%22+++++++++++%0A%22Hulluh%22++++++++++%0A%22abcdefggfedcba%22++%0A%22abcdefggfabc%22++++%0A%22AbbA%22++++++++++++%0A%22This+input+is+a+lot+like+the+last+one%2C+but+with+more+characters+that+don%27t+change+the+output.+AbbA%22+&debug=0).
```
e                Last element in list, this works out to longest one
  _I             Invariance under reverse, this detect palindrome
   #             Filter
   jL            Map join
    \|           By "|"
    cL2          Map chop in two pieces
     .:Q)        Substrings. Implicit Q). ) makes it do all substrings.
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), ~~19~~ ~~17~~ 14 bytes
Code:
```
Œévy2ä'|ý©ÂQi®
```
Explanation:
```
Œ                # Get all substrings of the input
 é               # Sort by length (shortest first)
  vy             # For each element...
    2ä           # Split into two pieces
      '|ý        # Join by "|"
         ©       # Copy this into the register
          Â      # Bifurcate, pushing a and reversed a
           Q     # Check if it's a palindrome
            i®   # If so, push that string again
                 # Implicit, the top element is outputted
```
Uses the **CP-1252** encoding. [Try it online!](http://05ab1e.tryitonline.net/#code=xZLDqXZ5MsOkJ3zDvcKpw4JRacKu&input=YWJjZGVmZ2dmZWRjYmE).
[Answer]
# Python 2, ~~102~~ 97 bytes
```
def f(s):h=len(s)/2;r=s[:h]+'|'+s[h:];return s and max(r*(r==r[::-1]),f(s[1:]),f(s[:-1]),key=len)
```
Rather slow and inefficient... Verify the smaller test cases on [Ideone](http://ideone.com/NckMlB).
[Answer]
# JavaScript, ~~100~~ 99 bytes
```
s=>eval('for(O=i=0;s[i++];O=O[j+j]?O:o)for(o="|",j=0;(S=s[i-1-j])&&S==s[i+j++];o=S+o+S);O[1]?O:""')
```
**or**
```
s=>eval('for(O="",i=0;s[i++];O=O[j+j]||j<2?O:o)for(o="|",j=0;(S=s[i-1-j])&&S==s[i+j++];o=S+o+S);O')
```
[Answer]
# Lua, 133 bytes
```
s=...for i=#s,1,-1 do for j=1,#s-i do m=j+i/2-i%2/2t=s:sub(j,m).."|"..s:sub(m+1,i+j)if t==t.reverse(t)then print(t)return end end end
```
[Verify all testcases on Ideone.com](http://ideone.com/OmmYrR).
[Answer]
## [Retina](https://github.com/m-ender/retina), 66 bytes
Byte count assumes ISO 8859-1 encoding.
```
M!&`(.)+(?<-1>\1)+(?(1)¶)
O$#`.+
$.&
A-2`
^(.)+?(?=(?<-1>.)+$)
$&|
```
[Try it online!](http://retina.tryitonline.net/#code=JShHYApNISZgKC4pKyg_PC0xPlwxKSsoPygxKcK2KQpPJCNgLisKJC4mCkEtMmAKXiguKSs_KD89KD88LTE-LikrJCkKJCZ8&input=SGVsbG8gV29ybGQKUHJvZ3JhbW1pbmcgUHV6emxlcyBhbmQgQ29kZS1Hb2xmCmFiY2JhCkh1bGx1aAphYmNkZWZnZ2ZlZGNiYQphYmNkZWZnZ2ZhYmMKQWJiQQpUaGlzIGlucHV0IGlzIGEgbG90IGxpa2UgdGhlIGxhc3Qgb25lLCBidXQgd2l0aCBtb3JlIGNoYXJhY3RlcnMgdGhhdCBkb24ndCBjaGFuZ2UgdGhlIG91dHB1dC4gQWJiQQ) (The first line enables testing of several linefeed-separated test cases at once.)
Hmmm, much longer than I would like...
[Answer]
# JavaScript (ES6), 91
```
s=>[...s].map((d,i)=>{for(a='|',j=0;d=s[i-j],d&&d==s[i-~j];r=r[j+++j]?r:a)a=d+a+d},r='')&&r
```
*Less golfed*
```
f=s=>
  [...s].map(
    (d,i) => {
    for(a='|', j=0; d=s[i-j], d&&d==s[i-~j]; r = r[j++ +j]? r : a)
      a = d+a+d
    }, r=''
  ) && r
```
**Test**
```
F=
s=>[...s].map((d,i)=>{for(a='|',j=0;d=s[i-j],d&&d==s[i-~j];r=r[j+++j]?r:a)a=d+a+d},r='')&&r
;[["Hello World", "l|l"]
,["Programming Puzzles and Code-Golf", "m|m"]
,["abcba", ""]
,["Hulluh", "ul|lu"]
,["abcdefggfedcba", "abcdefg|gfedcba"]
,["abcdefggfabc", "fg|gf"]
,["AbbA", "Ab|bA"]
,["This input is a lot like the last one, but with more characters that don't change the output. AbbA", "Ab|bA"]]
.forEach(t=>{
  var i=t[0],k=t[1],r=F(i)
  console.log(k==r?'OK ':'KO ',i+' -> '+r,k!=r?'(check '+k+')':'')
})  
```
[Answer]
## Perl 5, ~~105~~ ~~100~~ 98 + 1 = ~~106~~ ~~101~~ 99 bytes
```
/(?=((.)(?1)?\2)(?{[push@_,$1})(?!))/;($_)=sort{length$b<=>length$a}@_;substr($_,length>>1,0)='|'if$_
```
I just wanted to give recursive regexes a go. Needs the `-p` option. Edit: Saved (crossed out 4) 7 bytes thanks to @msh210. (The missing byte is due to a saving that was superseded by @msh210's latest saving.)
[Answer]
## Python 2, 91 bytes
```
f=lambda s,p='':s and max((''<p<=s<p+'\x7f')*(p[::-1]+'|'+p),f(s[1:]),f(s[1:],s[0]+p),key=len)
```
Replace `\x7f` with the actual character DEL, which is ASCII 127 (credit to Dennis).
This follows a similar strategy to [Dennis's answer](https://codegolf.stackexchange.com/a/84402/20260) of using `max` and recursively branching to find the longest palindrome interval. But, instead, it finds the left half, checking that the corresponding mirrored right half comes right after it with a [self-made startswith](https://codegolf.stackexchange.com/a/51783/20260).
The function guesses whether the first character is in the mirrored left half. If not, it just drops it and recurses on the remainder. If it is, it's added to to the stack `p` of reversed characters. If the string ever starts with the stack, the mirror string is generated and considered as a possible longest mirror. To avoid `|` as an output, only non-empty stacks are considered.
[Answer]
# Haskell, ~~126~~ 111 bytes
```
(!)=drop
f s|n<-length s=last$"":[a++'|':b|k<-[1..n],t<-map(!s)[1..n-k],let[a,b]=take k<$>[t,k!t],a==reverse b]
```
[Answer]
# TSQL ~~227~~ 223 bytes
I hardcoded the length to max 99 bytes, this saved bytes but made it slower. It still have a decent performance though.
**Golfed:**
```
DECLARE @t varchar(99)='AbccbA'
,@z char(99)='',@a INT=0,@ INT=0WHILE @a<LEN(@t)SELECT
@z=IIF(LEN(x)>LEN(@z)/2and @t LIKE'%'+x+REVERSE(x)+'%'COLLATE
Thai_bin,x+'|'+REVERSE(x),@z),@=IIF(@=50,1,@+1),@a+=IIF(@=1,1,0)FROM(SELECT
SUBSTRING(@t,@a,@)x)x PRINT @z
```
**Ungolfed:**
```
DECLARE @t varchar(99)='AbccbA'
,@z char(99)='',
@a INT=0,
@ INT=0
WHILE @a<LEN(@t)
  SELECT
    @z=IIF(LEN(x)>LEN(@z)/2and @t LIKE'%'+x+REVERSE(x)+'%'COLLATE Thai_bin,x+'|'
       +REVERSE(x),@z),
    @=IIF(@=99,1,@+1),
    @a+=IIF(@=1,1,0)
  FROM
    (SELECT SUBSTRING(@t,@a,@)x)x
PRINT @z
```
**[Fiddle](https://data.stackexchange.com/stackoverflow/query/edit/507690)**
[Answer]
# [Husk](https://github.com/barbuz/Husk), 12 bytes
```
►S=↔ΘmoJ'|½Q
```
[Try it online!](https://tio.run/##PY09TgQxDIWvYk2zzcINKFYUrKgWsRIFonAmniRaJ0b5EdKKBgpOgBBnQaLhABxiLhIMI1G95@89276VQ4/z81Of3z6uz@aX1@/3KJerx6/Pq9777bAlZoEbyWyH9bDL4jLGGJKDXTsemQpgsnAulk4uhCftoBkNqm4bc/MLsDQ5N5Fdkn@gRseNMRuVvQ8FQrpvFdQgsFTgcCConoCxVJBEazCaP4TqIUomGD1mHCvlojWsYCWt6i9NblmUVvXiKfw9ufsB "Husk – Try It Online")
-1 from Leo.
[Answer]
## Python 2, 149 bytes
```
R,L,s=range,len,input()
t=max([s[i:j/2+i/2]for i in R(L(s))for j in R(L(s)+1)if s[i:j]==s[i:j][::-1]and(j-i)%2<1],key=L)
print t+'|'*(L(t)>0)+t[::-1]
```
[Try it online](http://ideone.com/fork/jxoIbM)
This program finds the first half of the largest palindromic substring of even length, and prints that string, followed by a `|`, followed by that string reversed. If there is no suitable string, `t` will be the empty string, and `'|'*(L(t)>0)` will evaluate to the empty string.
[Answer]
# Java 8, ~~294~~ ~~283~~ 232 bytes
```
s->{int l=s.length(),i=0,j,z,y=0;String a,b="";for(;i<l;i++)for(j=0;j<=l-i;)if((a=s.substring(i,i+j++)).equals(new StringBuffer(a).reverse()+"")&(z=a.length())%2<1&z>y){y=z;b=a;}return y>0?b.substring(0,y/=2)+"|"+b.substring(y):"";}
```
**Explanation:**
[Try it here.](https://tio.run/##jVJNb9swDL33V3AG1kmw42U9znGGbof1sqLABuww9EDbtC1XljJJTmFn@e0Z0xpFLkUKSAA/Hh/JB3a4xYXdkOmqh0Op0Xv4gcrsLgCUCeRqLAlujy7Az@CUaaAUs@FlxvE9f34@YFAl3IKBHA5@sd5xPejcp5pME1ohE5Uvky6ZkjFfZjMFJkUeRVltncjUSmcqjuXR6RjSrXK9UJlUtRDIPH4o/FOVUImKO0bKlP4OqL0w9DhP93Woa3ICZepoS86TkHEUyUsx5fgyiXx/tfp0Oa1HuRvzKStyzPaOwuAMjOvll@Kk1TIZP@ZXzPEvik/jo/zMc@8P2fP2m6HQvP0swtaqCnqWcVbqzz2gnDUcfaA@tUNIN5wK2giTliK6Ia1tAr@t09W7SD4p@zr6ztnGYd8fJbwbpkmTBzQVfLMVLb5bXZ9lwKIs8CzqZtB6aN9CVlHdNDVVb2F9gbNxFnxdFNdnQb9a5fleN0MANhC05dNTDwShJeCjDmANJVBw/lGFFnrrCMoWHZZ8455hGKCy5kM4Rk3zXMhtmDGFkxH2F/vDfw)
```
s->{                               // Method with String as both parameter and return-type
  int l=s.length(),                //  Length of the input-String
      i=0,j,                       //  Index-integers
      z,y=0;                       //  Temp-integers
  String a,b="";                   //  Temp-Strings
  for(;i<l;i++)                    //  Loop (1) from 0 to `l` (exclusive)
    for(j=0;j<=l-i;                //   Inner loop (2) from 0 to `l-i` (inclusive)
      if((a=s.substring(i,i+j++))  //    Set the current substring to `a`
          .equals(new StringBuffer(a).reverse()+"")
                                   //    If `a` is a palindrome
         &(z=a.length())%2<1       //    And the length of `a` is even
         &z>y){                    //    And the length of `a` is larger than `y`
        y=z;                       //     Change `y` to `z`
        b=a;}                      //     Change `b` to `a`
                                   //   End of inner loop (2) (implicit / single-line body)
                                   //  End of loop (1) (implicit / single-line body)
  return y>0?                      //  If the result-length is not 0:
    b.substring(0,y/=2)+"|"+b.substring(y)
                                   //   Return the result
   :                               //  Else:
    "";                            //   Return an empty String
}                                  // End of method
```
]