[Question]
  [
Given a string `s`, return the smallest contiguous substring you can remove to create a palindrome.
---
# Examples:
```
800233008   -> 2
racecarFOOL -> FOOL
abcdedcba   -> (empty string)
ngryL Myrgn -> "L " (or " M")
123456789   -> 12345678 (or 23456789)
aabcdbaa    -> c (or d)
[[]]        -> [[ (or ]])
a           -> (empty string)
```
Test case suggestions from users (if you find an edge case not listed, please post a comment):
```
aabaab      -> b    | Suggested by Zgarb, some returned "aa".
```
---
# Rules
* Only printable ASCII characters will appear in the input (no newlines, keep it simple).
* Not really a rule, but note `<>`, `/\`, `()`, `[]` and `{}` are not palindromes.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), smallest byte-count wins.
---
*+100 bounty has been claimed by Adnan*
  
[Answer]
# [J](http://jsoftware.com/), 24 bytes
```
(0{::(-:|.)\.#&,<\)~i.@#
```
[Try it online!](https://tio.run/##FYq7DoIwGEb3PsUfSShNsKnUCxYxTk4YHgAY2kJRB0zKRLy8em2HL/nOyXk6M0MpgIGfS9hbiGQtPpS0NIrTU0t@D3qJHEErCtiUAkMKXwFmRmjQ9xckhSHxGXDOWMY5YzkusJV60NJe67ryJJXuh14r6f802qWC22LHydMm49vd/pAfQxUyJUPUNF0XDHZ/ "J – Try It Online")
## Explanation
```
(0{::(-:|.)\.#&,<\)~i.@#  Input: array of chars S
                       #  Length of S
                    i.@   Range, [0, 1, ..., len(S)-1]
(                 )~      Dyadic verb on range and S
           \.               For each outfix of S of size x in range
        |.                    Reverse
      -:                      Matches input (is palindrome)
                <\          Box each infix of S of size x in range
             #&,            Flatten each and copy the ones that match
 0{::                       Fetch the result and index 0 and return
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 16 bytes
```
Ḣ;Ṫµ=Ṛ
0,0jŒṖÇÞṪ
```
[Try it online!](https://tio.run/##y0rNyan8///hjkXWD3euOrTV9uHOWVwGOgZZRyc93DntcPvheUDh/w93bznc/qhpTeT//xYGBkbGxgYGFlxFicmpyYlFbv7@PlyJSckpqSnJSYlceelFlT4KvpVF6XlchkbGJqZm5haWXIkgBUmJiVzR0bGxXIkgPhABAA "Jelly – Try It Online")
### How it works
```
0,0jŒṖÇÞṪ  Main link. Argument: s (string)
0,0j       Join [0, 0], separating by s. This prepends and appends a 0 to s.
    ŒṖ     Build all partitions of the resulting array.
      ÇÞ   Sort the partitions by the helper link.
           As a side effect, this will remove the first and last element of each
           partition. The 0's make sure that not removing any characters from s
           will still remove [0] from both sides.
        Ṫ  Tail; extract the last one.
Ḣ;Ṫµ=Ṛ     Helper link. Argument: A (array/partition)
Ḣ          Head; yield and remove the first chunk of A.
  Ṫ        Tail; yield and remove the last chunk of A.
 ;         Concatenate head and tail.
   µ=Ṛ     Compare the result, character by character, with its reverse.
           A palindrome of length l will yield an array of l 1's, while a
           non-palindrome of length l will yield an array with at least one 0 among
           the first l/2 Booleans. The lexicographically largest result is the one
           with the longest prefix of 1's, which corresponds to the longest
           palindrome among the outfixes.
```
[Answer]
## [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), ~~53~~ 51 bytes
Byte count assumes CP-1252 encoding.
```
±{a___,Shortest@b___,c___}/;PalindromeQ[a<>c]:={b}
```
[Try it online!](https://tio.run/##NYxNCoMwFIT3niK4LIJW@2N/EQpdFEWLSxF5iUEDGiHGhYiH6hV6MWuKbh7zzbyZGmRJa5CMwDR9PwNkWWbEZSMkbaWHFZH5jOYlgorxXDQ1fSdwvZP0fBvwOEWCcYm8DYrlrIpXw7iiqOragPGuVfAoQQCRVLTI9NCgIaS7lmU7jmW5uoEUzzklIJ5h6C8OYJLTnGBYmBei91HQi4IvztZ2dvvD0T3pxr@gGhjW/yRJ03VK18bpBw "Wolfram Language (Mathematica) – Try It Online")
Defines a unary operator `±` (or a function `PlusMinus`). Input and output are lists of characters. The test suite does the conversion from and to actual strings for convenience.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 18 bytes
```
ā<Œ¯¸«ʒRõsǝÂQ}éнèJ
```
Uses the **05AB1E** encoding. [Try it online!](https://tio.run/##ATMAzP8wNWFiMWX//8SBPMWSwq/CuMKrypJSw7Vzx53DglF9w6nQvcOoSv//cmFjZWNhckZPT0w "05AB1E – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 20 bytes
```
ŒḂ⁹Ƥ
çÐ€JN$Ẏi1ịẆẋ⁻Ṛ$
```
[Try it online!](https://tio.run/##AT0Awv9qZWxsef//xZLhuILigbnGpArDp8OQ4oKsSk4k4bqOaTHhu4vhuobhuovigbvhuZok////YWJjZGVkY2Jh "Jelly – Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), 97 bytes
```
f=lambda s,p='	':min([s][:p[::-1]in p+p]+(s and[f(s[1:],p+s[0]),f(s[:-1],s[-1]+p)]or[p]),key=len)
```
[Try it online!](https://tio.run/##LY7LasMwEEXX6VfMThJWihT34QrcZVcp@YBBi/ErNY1lIXljQr7dlUxhGDhzD8P16/Izu3LbhvpGU9MRROlrdmBmGh3HaNF4NOao7ejAF94WPAK5DgceURsrfRFRWSEzZ01GTLvwws4BfQp@@7W@9U5swxwgQnrDKqVOZalUxSSwQG3fUvi6XM4ZqWm7vmsbyuCuYT3D9xquLqM@lS@vb@/Vxy5ms6HdQ7R2v/0HaZh5OvgwuoWzu9H6AcdPuD/Yc2ox0cKjhNRYCLH9AQ "Python 3 – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 116 bytes
```
def f(i):R=range(len(i)+1);print min([i[y:k+1]for y in R for k in R if(i[:y]+i[k+1:])[::-1]==i[:y]+i[k+1:]],key=len)
```
[Try it online!](https://tio.run/##VY6xboMwFEX3fsWTJ1skFYYmIUbumClVpKyWBwOGvEId5BBV/npqK1O3e66O7ntzWG53V6xrZ3voKTJxld64wdLJuogZZ/Xs0S3wg44qVEGMGdf93UMAdHCFFMdXxDigRNAZqigJzZQQW66l/NfqzWiDjPNs/b3hZIELQJBxYn4ulNXwuofv0/fzsVC@YxmB7SfZ1Om/lVR5XpRlnlfkjXjT2tb40@VyjmSatrNd25iY3eDDGb6CH1wkXpQfu/2hOiYraY1JklJap4b8AQ "Python 2 – Try It Online")
Saved a couple of bytes with help from [Halvard Hummel](https://codegolf.stackexchange.com/users/72350/halvard-hummel)!
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~26~~ 22 bytes
```
¬£¬ËUjEY ê¬©UtEY
c æ+0
```
[Test it online!](https://ethproductions.github.io/japt/?v=1.4.5&code=rKOsy1VqRVkg6qypVXRFWQpjIOYrMA==&input=ImhlbGxoIiAtUQ==) Trying to figure out how to map `false` to something falsy and any string to something truthy in one byte. Currently I'm using `+0`...
[Answer]
# [Bash](https://www.gnu.org/software/bash/), 108 bytes
```
for((j=0;;j++)){
for((i=0;i<${#1};i++)){
r=${1:0:i}${1:j+i}
[[ $r = `rev<<<$r` ]]&&echo "${1:i:j}"&&exit
}
}
```
Takes input as command-line argument.
[Try it online!](https://tio.run/##JcxLCsMgFIXhuau4WJsoTpKp0R20KwiBtCWP68CUm1Aagmu3th0d@Dj899s6pydh2EYo@XnlJXAh07iQlN5VTeO1VupgP8AMaMVxqmODfycnjtpUBuN3vcbI2hYEgYOehpe1VlAPXVcUw2Necju/0PjIM7xxY5HFpHhKYaL9AtedpvAB) with quotes printed around the output for viewing leading/trailing spaces.
[Answer]
# [Prolog](http://www.swi-prolog.org/), 271 byte
```
p([_]).
p([X,X]).
p([X|Y]):-append([P,[X]],Y),p(P).
s(P,M,S,R,N):-p(P),append([M,S],N).
s(P,M,S,S,N):-p(S),append([P,M],N).
s(P,M,S,P,M):-append([P,S],X),p(X).
d(Y,P,N):-
    findall([A,B,C],(append([R,M,X],Y),s(R,M,X,B,C),length(B,A)),S),
    sort(1,@>,S,[[_,P,N]|_]).
```
At some point I realized this is going to be huge by code-golf standards, so I kept a few extra blank spaces to preserve the resemblance to the non-obfuscated version. But I still think it might be interesting since it's a different approach to the problem.
The non-obfuscated version:
```
palindrome([_]).
palindrome([X, X]).
palindrome([X | Xs]) :-
    append([Prefix, [X]], Xs),
    palindrome(Prefix).
palindrome_split(Prefix, Mid, Suffix, Prefix, N) :-
    palindrome(Prefix),
    append([Mid, Suffix], N).
palindrome_split(Prefix, Mid, Suffix, Suffix, N) :-
    palindrome(Suffix),
    append([Prefix, Mid], N).
palindrome_split(Prefix, Mid, Suffix, P, Mid) :-
    append([Prefix, Suffix], P),
    palindrome(P).
palindrome_downgrade(NP, P, N):-
    findall(
        [La, Pa, Na],
        (append([Prefix, Mid, Suffix], NP),
         palindrome_split(Prefix, Mid, Suffix, Pa, Na),
         length(Pa, La)),
        Palindromes),
    sort(1, @>, Palindromes, [[_, P, N] | _]).
```
[Answer]
## C++, ~~254~~ ~~248~~ 246 bytes
-6 bytes thanks to Zacharý
-2 bytes thanks to Toby Speight
```
#include<string>
#define S size()
#define T return
using s=std::string;int p(s t){for(int i=0;i<t.S;++i)if(t[i]!=t[t.S-i-1])T 0;T 1;}s d(s e){if(!p(e))for(int i,w=1;w<e.S;++w)for(i=0;i<=e.S-w;++i){s t=e;t.erase(i,w);if(p(t))T e.substr(i,w);}T"";}
```
So...
* I used `T` as a macro definition because doing `R""` as another effect on string literal ( it's a prefix used to define raw string literals, see [cppreference](http://en.cppreference.com/w/cpp/language/string_literal) for more informations ) that is not there when i do `T""`
* Preprocessor definitions can't be on the same line, and have to have at least one space between the name and the content in the definition
* 2 functions : `p(std::string)` to test if the string is a palindrome. If it is, it returns `1` which casts to `true`, else it returns `0`, which casts to `false`
* The algorithm loops over the whole string testing if it's a palindrome when erasing each time 1 element, then test erasing 2 elements ( loops over that to the maximum size of the string ), from the first index to `the last index - number of erased char`. If it finds erasing some part is a palindrome, then, it returns. For example, when passing the string `"aabcdbaa"` as parameter, both `c` and `d` are valid answer, but this code will return `c` because erasing it and testing if it's a palindrome comes before testing if erasing `d` and testing if it's palindrome
* Here is the code to test :
```
std::initializer_list<std::pair<std::string, std::string>> test{
    {"800233008","2"},
    { "racecarFOOL","FOOL" },
    { "abcdedcba","" },
    { "ngryL Myrgn","L " },
    { "123456789","12345678" },
    { "aabcdbaa","c" },
    { "[[]]","[[" },
    { "a","" },
    { "aabaab","b" }
};
for (const auto& a : test) {
    if (a.second != d(a.first)) {
        std::cout << "Error on : " << a.first << " - Answer : " << a.second  << " - Current : " << d(a.first) << '\n';
    }
}
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 33 bytes
```
r/ḟ@J}ị
“”µJp`ç³$ŒḂ$Ðfạ/ÞḢr/ịµŒḂ?
```
[Try it online!](https://tio.run/##y0rNyan8/79I/@GO@Q5etQ93d3M9apjzqGHuoa1eBQmHlx/arHJ00sMdTSqHJ6Q93LVQ//C8hzsWAVXv7j60FSxh/////8Sk5JTUlOSkRAA "Jelly – Try It Online")
[Answer]
# PHP 104+1 bytes
```
while(~($s=$argn)[$e+$i++]?:++$e|$i=0)strrev($t=substr_replace($s,"",$i,$e))==$t&&die(substr($s,$i,$e));
```
Run as pipe with `-nR` or [try it online](http://sandbox.onlinephpfunctions.com/code/f9d2e103b0a075a7cf59bcfaf3c43ba72a1e263c).
[Answer]
# [Haskell](https://www.haskell.org/), ~~109~~ 105 bytes
```
snd.minimum.([]#)
p#s@(a:b)=[(i,take i s)|i<-[0..length s],(==)<*>reverse$p++drop i s]++(p++[a])#b
p#_=[]
```
[Try it online!](https://tio.run/##HczRTsMgGIbhc6@CtB6A7QiuulUzjEcebdkFIFl@KO3IChKoJku8dnHt4fPlzXeGdDHjmHv@mZPvqLPeum9HsZAluQtlesfwqggX2NYTXAyyKJFfu1sJRulo/DCdUZI15pzsHt6i@TExmftQVV38CnMsqwrfKECSUt0OT1zI7MB6xJGDcDghHKL1E@0JEkXL2LppGGuLGhURtNEQP47H/UxQujOdVjDDD/G6R4drHPzMx3Xz9LzZti9LOJcKlk4IKZetkPlP9yMMKa90CP8 "Haskell – Try It Online")
EDIT: Thanks @H.PWiz for taking off 4 bytes! I need to get better with those monads!
[Answer]
# JavaScript, 90 bytes
```
a=>a.map((_,p)=>a.map((_,q)=>k||(t=(b=[...a]).splice(q,p),k=''+b==b.reverse()&&t)),k=0)&&k
```
[Try it online!](https://tio.run/##TYzLboMwEEX3/QpW8VgEy4SmpQtnV1ap8gEINeNHEIHajkGRIuXfKSm0qjSLOfce3TNesVeh8UNinTbjSYwodsi@0AN8rj39B5cJ2vsdBgFSlIwxrCjrfdcoA5dJXbeCkFgKIVkwVxN6A3S1Guij4NPXjoWYxpWzvesM61wNyDzqd6shTWlMoiRJdhGJT/C7fnaNPR7pUwEk53yTZZzn5AcDKqMwFIfDfg5QKm20kjijrcNtH33cQm3nIN1kz9uX1/xt0R@@xMUuy6pa8r96OkLHbw)
```
f=
a=>a.map((_,p)=>a.map((_,q)=>k||(t=(b=[...a]).splice(q,p),k=''+b==b.reverse()&&t)),k=0)&&k
F=a=>console.log(a.padEnd(11)+' ---> '+f([...a]).join``)
F('800233008')
F('racecarFOOL')
F('abcdedcba')
F('ngryL Myrgn')
F('123456789')
F('aabcdbaa')
F('[[]]')
F('a')
F('aabaab')
```
[Answer]
# Perl 5, 72 +1 (-p) bytes
```
$\=$_;/.*(?{$,=$`.$';$\=$&if length$&<length$\&&$,eq reverse$,})(?!)/g}{
```
[Try it online](https://tio.run/##K0gtyjH9/18lxlYl3lpfT0vDvlpFx1YlQU9F3RokqJaZppCTmpdekqGiZgNlxKipqeikFioUpZalFhWnqujUamrYK2rqp9dW//9vYWBgYGRsbGBg8S@/oCQzP6/4v24BAA)
[Answer]
# JavaScript (ES6), ~~91~~ 78 bytes
```
(s,i=0,j=0,S=[...s],b=S.splice(i,j))=>S+''==S.reverse()?b:f(s,s[++i]?i:!++j,j)
```
Input and output are lists of characters.
Recursively removes a larger and larger slice from the input until a palindrome is found.
**Snippet:**
```
f=
(s,i=0,j=0,S=[...s],b=S.splice(i,j))=>S+''==S.reverse()?b:f(s,s[++i]?i:!++j,j)
console.log(f([...'800233008']).join``)   // 2
console.log(f([...'racecarFOOL']).join``) // FOOL
console.log(f([...'abcdedcba']).join``)   // (empty string)
console.log(f([...'ngryL Myrgn']).join``) // "L " (or " M")
console.log(f([...'123456789']).join``)   // 12345678 (or 23456789)
console.log(f([...'aabcdbaa']).join``)    // c (or d)
console.log(f([...'[[]]']).join``)        // [[ (or ]])
console.log(f([...'a']).join``)           // (empty string)
```
[Answer]
# TSQL (2016) 349B
Not the most compact but straightforward solution:
```
DECLARE @i VARCHAR(255)='racecarFOOL'
;WITH DAT(v,i,l)AS(SELECT value,(ROW_NUMBER()OVER(ORDER BY value))-1,LEN(@i)FROM STRING_SPLIT(REPLICATE(@i+';',LEN(@i)+1),';')WHERE value<>'')
SELECT TOP 1C,S
FROM(SELECT LEFT(D.v, D.i)+SUBSTRING(D.v,D.i+E.i+1,D.l)C,SUBSTRING(D.v,D.i+1,E.i)S
FROM DAT D CROSS APPLY DAT E)C
WHERE C=REVERSE(C)
ORDER BY LEN(C)DESC
```
[Answer]
# [Husk](https://github.com/barbuz/Husk), 18 bytes
```
◄LfmS=↔†!⁰ṠM-Qŀ⁰Q⁰
```
[Try it online!](https://tio.run/##yygtzv7//9H0Fp@03GDbR21THjUsUHzUuOHhzgW@uoFHG4DMQCD@//@/UmJiEhApAQA "Husk – Try It Online")
## Explanation
```
◄LfmS=↔†!⁰ṠM-Qŀ⁰Q⁰  Input is a string, say s="aab"
              ŀ⁰    Indices of s: x=[1,2,3]
             Q      Slices: [[],[1],[1,2],[2],[1,2,3],[2,3],[3]]
          ṠM-       Remove each from x: [[1,2,3],[2,3],[3],[1,3],[],[1],[1,2]]
       †!⁰          Index into s: ["aab","ab","b","ab","","a","aa"]
   mS=↔             Check which are palindromes: [0,0,1,0,1,1,1]
  f             Q⁰  Filter the slices of s by this list: ["aa","aab","ab","b"]
◄L                  Minimum on length: "b"
```
[Answer]
# [Haskell](https://www.haskell.org/), ~~98~~ ~~94~~ ~~81~~ 80 bytes
```
""#0
(h#n)t|(==)=<<reverse$h++drop n t=take n t|x:r<-t=(h++[x])#n$r|m<-n+1=t#m$h
```
[Try it online!](https://tio.run/##ZU/LboMwELz7K1aGA1aKRKCPtMI99pQoH@ByMMaFKMGxjFUlKv31UhsaEqkry96dmdWMG97t5eEw1PR9wDhIUNQEitg@opTQPDfyU5pOhs1iUZmjBgWWWr6XvulPLyaPLY0cyU4FCVRo@jaP1WJJbdCGzdDynQIK2uyUhRBarqEGhldJkmZZkqzwHTZcSMHN23a7dhMvRSUrUXLXq9qc17A5m1q5aZlm9w@PT6tnr/KyknsRY0XhkQl1BxcIfcVotgCA@BVSdOPjAf@i2W0SRbLV9gyddXFrgm78PYvXgCE6GndvMEFznmn3Mo6KC0XQJSlMKjHSFUE@NvyVwxkbiaJwG3Ct/5mmP85sieLv4Ud8HHjdDbHQ@hc "Haskell – Try It Online") Example usage: `""#0 $ "aabaab"` yields `"b"`.
*Edit: -1 byte thanks to Ørjan Johansen.*
[Answer]
# C++, ~~189~~ ~~186~~ ~~176~~ 167 bytes
I started with [HatsuPointerKun's answer](/a/147373), changing the test to simply compare equality with reversed string; then I changed how we enumerate the candidate strings. Following this, the macros were only used once or twice each, and it was shorter to inline them.
```
#include<string>
using s=std::string;s d(s e){for(int i,w=0;;++w){s t=e.substr(w);for(i=-1;++i<=t.size();t[i]=e[i])if(t==s{t.rbegin(),t.rend()})return e.substr(i,w);}}
```
## Explanation
Equivalent readable code:
```
std::string downgrade(std::string e)
{
    for (int w=0; ; ++w) {
        std::string t = e.substr(w);
        for (int i=0;  i<=t.size();  ++i) {
            if (t == std::string{t.rbegin(),t.rend()})
                // We made a palindrome by removing w chars beginning at i
                return e.substr(i,w);
            t[i] = e[i];  // next candidate
        }
    }
}
```
The enumeration of candidates begins by initialising a string with the first `w` characters omitted, and then copying successive characters from the original to move the gap. For example, with the string `foobar` and `w`==2:
```
foobar
  ↓↓↓↓
  obar
```
```
foobar
↓
fbar
```
```
foobar
 ↓
foar
```
```
foobar
  ↓
foor
```
```
foobar
   ↓
foob
```
The first pass (with `w`==0) is a no-op, so the full string will be considered over and over again. That's fine - golfing trumps efficiency! The last iteration of this loop will access the one-past-the-end index; I seem to get away with that with GCC, but strictly, that's Undefined Behaviour.
## Test program
A direct lift from [HatsuPointerKun's answer](/a/147373):
```
static const std::initializer_list<std::pair<std::string, std::string>> test{
    { "800233008", "2" },
    { "racecarFOOL", "FOOL" },
    { "abcdedcba", "" },
    { "ngryL Myrgn", "L " },
    { "123456789", "12345678" },
    { "aabcdbaa", "c" },
    { "[[]]", "[[" },
    { "a","" },
    { "aabaab", "b" }
};
#include <iostream>
int main()
{
    for (const auto& a : test) {
        if (a.second != d(a.first)) {
            std::cout << "Error on: " << a.first
                      << " - Expected: " << a.second
                      << " - Actual: " << d(a.first) << '\n';
        }
    }
}
```
[Answer]
## REXX, 132 bytes
```
a=arg(1)
l=length(a)
do i=1 to l
  do j=0 to l-i+1
    b=delstr(a,i,j)
    if b=reverse(b) & m>j then do
      m=j
      s=substr(a,i,j)
      end
    end
  end
say s
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~86~~ 84 bytes
```
->s{l=i=0
(l+=(i+=1)/z=s.size-l+1
i%=z)while(w=s[0,i]+s[i+l..-1])!=w.reverse
s[i,l]}
```
[Try it online!](https://tio.run/##LcrNjoIwGIXhfa@idjIBUqgF5gcXn8tZabyApotSqzZpzKRFCSDXjhrYnfPk9be6m04wZdswOLDAUewoxJZCnqx7CCzY3mSO5sh@Qp@0F@tM3EIQPLWSBmGpYyzLZbKClnlzNz4Y9OLUyXESCGNScV6UJecVSd/XK2208n@Hw24GVeujOepazfd69t0O7zt/vs6QF@XX989vtVnyd1@rpRZCysUJkswofcHDo3ng/1sTMIk@hmaMcLbFr3USjRwjMk5P "Ruby – Try It Online")
* Saved 2 bytes thanks to Cyoce
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 307 bytes
```
#define T malloc(K)
P(S,i,y,z,k,u,L,K,V)char*S;{char*M,*R,*E;K=strlen(S);M=T;R=T;E=T;for(i=0;i<K;++i){for(y=0;y<=K-i;++y){strcpy(M,S);for(z=y;z<y+i;E[z-y]=M[z],++z);for(k=y;k+i<=K;M[k]=M[k+i],++k);V=strlen(M);strcpy(R,M);for(u=0;u<V/2;L=R[u],R[u]=R[V-u-1],R[V-u-1]=L,++u);if(!strcmp(M,R))puts(E),exit(0);}}}
```
[Try it online!](https://tio.run/##NVDLboMwELznK2h68cKi5tXT4iMnYikiEReUQ0RIa5EASnBVg/h2um7alfY1oxmvXIQfRTFNr@fyouvSO3i30/XaFCKB2U7sUaPFHis0uMUEMyg@T3d/T8NvV@in6MeUyEd3v5a12AMpeaCUM@a8NHeh5YJ0lFAQaBgcYBmwkUxCzZiFgaVFa4VCFju@l5b6yAaa4rwP7VGqvD9iEPRPumK6CjQbkMorx/Lm@Aoo@79DAf3ZpqieOsPPmih7W9FWprk5ois8ZaEJl257DnLLVgZIX8SLs7i1fFkK0JruIWLA8lt3YgE0juOk645/S9fiq9Fn8IaZx7ET8@VqvXnfrFfLOdBsnH4A "C (gcc) – Try It Online")
]