24
1
The shortest code that finds all unique "sub-palindromes" of a string, that is: any substring with length > 1 that is a palindrome.
eg.1
input: "12131331"
output: "33", "121", "131", "313", "1331"
eg.2
input: "3333"
output: "33", "333", "3333"
1Can a string be it's own sub-palindrome? Since a string is it's own substring. – JPvdMerwe – 2011-01-29T12:17:03.320
@JPvdMerwe: Yes, off course. – Eelvex – 2011-01-29T12:39:33.340
Actually more importantly: what must the output of
333
be? Naively you'd end up printing33
twice – JPvdMerwe – 2011-01-29T12:41:00.143@JPvdMerwe: '333' -> '33', '333'. I'll edit the question accordingly. Thanks. – Eelvex – 2011-01-29T12:53:37.523
How is the output specified? Comma-delimited with quotes areound each sub-palindrome as you demonstrate here? One sub-p per line? – Joey – 2011-01-30T12:58:04.807
Related: How exactly is the input specified? A single line with the string in question delimited by quotes? – Joey – 2011-01-30T13:03:05.873
For input, just get a single string: stdin, command line, whatever. For output, we expect a simple list; no special formatting necessary. – Eelvex – 2011-01-30T13:20:40.297