g | x | w | all
Bytes Lang Time Link
008Pyth250210T070122ZGlory2Uk
006Brachylog250210T124418ZGlory2Uk
244Ruby250127T191012ZPufe
041Charcoal250124T103646ZNeil
007Vyxal250124T071024Zemanresu
015Haskell + hgl250124T163530ZWheat Wi
00805AB1E250124T092627ZKevin Cr
007Nekomata250124T074828Zalephalp
006Vyxal 3 l250124T074348Zlyxal
106JavaScript Node.js250124T072033Zl4m2
105250124T065243ZUsed_Bra

Pyth, 13 8 bytes

h_I#I#./

Try it online!

Based on the isaacg's answer

Old version:

V             # iterate through
 ./Q          # the list of partitions
    I         # if
     qQ       #    the input is equal
       s_MN   #    to the joined reversed partitions
           NB # output the substrings combination and break

Brachylog, 6 bytes

~cL↔ᵐL

Try it online!

Massively related to this answer.

Ruby, 244 bytes

First* polynomial solution, in O(n²). It is not very golfed besides using one letter variables and removing whitespace.

def f s
n=s.size
m=[[1]]
(1...n).map{|i|
a=[1]
a<<2 if s[i]==s[i-1]
m[i-1].map{|v|a<<v+2 if i>v&&s[i]==s[i-v-1]}
m<<a}
k=[[0,0]]
(0...n).map{|i|
k<<m[i].map{|v|[k[i-v+1][0]+1,v]}.min
}
z=[]
while n>0
y=n-k[n][1]
z.unshift s[y...n]
n=y
end
z
end

Creates a function f that receives the string as parameter and returns an array of strings.

Explanation:

It generates a matrix m with all sizes of palindromes ending on ith letter, then finds the best solution for the first i letters and saves on array k. Finally loops from the end of the string to the beginning using the best partial solutions to construct the actual substrings.

* At least it's the first I've seen...

Charcoal, 53 41 bytes

⊞υ⟦θ⟧Fυ¿¬ⅉ«≔⊟ιη¿ηFΦEη…η⊕λ⁼κ⮌κ⊞υ⁺ι⟦κ✂ηLκ⟧ι

Try it online! Link is to verbose version of code. Explanation:

⊞υ⟦θ⟧

Start a breadth-first search with the input string.

Fυ¿¬ⅉ«

Loop over all the search lists until an answer is found; as this is a breadth-first search it will automatically find the shortest answer first.

≔⊟ιη

Get the current suffix.

¿η

If it is not empty, then...

FΦEη…η⊕λ⁼κ⮌κ

... for each palindromic prefix...

⊞υ⁺ι⟦κ✂ηLκ⟧

... push a new search list with that prefix and a new suffix.

ι

Otherwise this list only contains palindromes, so it's the desired solution.

Vyxal, 7 bytes

øṖ'R⁼;t

Try it Online!

øṖ      # Partitions
  '  ;  # where
   R    # reversing each word
    ⁼   # yields the same list
      t # Take the last (= shortest) one

Haskell + hgl, 15 bytes

mBl<<pWK$eq~<Rv

Explanation

This works just like every other answer here. Get the shortest partition that is idempotent under map reverse.

Using parsers, 21 bytes

mBl<<gcy$lA h_>~ʃ<rv

Reflection

This is fine. I'm mostly concerned with improving the parser version.

05AB1E, 8 bytes

.œé.ΔDíQ

Try it online or verify all test cases.

Explanation:

.œ        # Get all partitions of the (implicit) input-string
  é       # Sort these partitions by length (shortest to longest)
   .Δ     # Then find the first/shortest partition that's truthy for:
     D    #  Duplicate the partition
      í   #  Reverse each inner part of the copy
       Q  #  Check if both lists are still the same
          # (after which the found result is output implicitly)

Nekomata, 7 bytes

J:ᵐ↔=aş

Attempt This Online!

J:ᵐ↔=aş
J           Find a partition of the input list
 :          Duplicate
  ᵐ↔        Reverse each part
    =       Check equality
     a      Get all possible solutions
      ş     Find the shortest one

Vyxal 3 -l, 6 (literate) bytes

list-partitions filter<
  vectorise-reverse ===
} tail

Vyxal It Online!

Effectively a port of EmanresuA's Vyxal 2 answer, but independently discovered (minus the tail bit, I originally tried minimum but wasn't sure that'd always return the shortest list)

JavaScript (Node.js), 106 bytes

f=([c,...s],o,g,b,...x)=>c?f(s,f(s,o,g=[g]+c,b=c+[b],...x),'','',...x,...g==b?[g]:g):g||x[o&&o.length]?o:x

Try it online!

JavaScript (Node.js), 114 bytes

f=(s,r=Z='',l='',...a)=>Z=s?[...s].map((c,i)=>(l+=c)==(r=c+r)&&f(s.slice(++i),'','',...a,l))&&Z:Z&&a[Z.length]?Z:a

Try it online!

watever

☾, 34 characters, 105 bytes

󰲡2􋌵ˣ⭥ᐵ󷹜²🃌xᑀ􍪸󷺿𝌂ᵜ⭥xᐵ󷸻ᵜx⨁ᐸᐸ󰒼🃌󱖔􋔭⋀○󷺺≡ᴙ⟞
Note: ☾ uses a custom font, but you can run this code in the Web UI.
code with custom font

Let's set aside a function to check that all strings in a list are palindromes:
part 1 image

The first goal is to get all binary strings with the same length as the input string x:
part 2 image
At this point in the code, we are manipulating the list ["0..00","0..01","0..10",..,"1..11"]

Building on top of this, we want to partition x based on the structure of the binary numbers. For example:
If x="abcde" and we want to partition by "00110", we make a pit stop at [[0,1],[2,3],[4]]
part 3 image

Next, we convert the list with numbers to the string characters at the indices:
part 4 image

Finally, we can finish by getting the first one sorted by length subject to our constraint:
part 5 image