2
- Copy and paste or
curl
this text: http://lorem-ipsum.me/api/text - Using any language make the text palindromic.
- You may remove letters.
- You may rearrange letters.
- The goal is to make the text palindromic by the sequence of the letters and spaces. The end result might not contain words. It will be merely a sequence of letters and spaces.
- Capital letters are considered the same as lowercase letters.
- You may use each letter only once, or you may remove the letter.
- You may also use each space only once. Or you may remove the space.
- The result should be the longest palindrome you can programmatically create from the text.
- While you could technically print just the letters
AaA
or something similar to it, that is not what I am looking for. - Your palindrome creator should work with any text.
- A palindrome, by definition, is a word, phrase, number, or other sequence of symbols that reads the same backward as forward. A sequence of symbols that reads the same backward as forward is the acceptable palindromic definition I am looking for in this
CodeGolf
example. - Scoring will be
Length of palindrome
/Length of code
. The winner is the one with the highest score.
Text:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, possimus voluptatem do ut vel deserunt laborum. cupidatat libero minim at a aute minus cupiditate excepturi reiciendis blanditiis, atque vero. dolorem dolores dolore corrupti aute recusandae repellat recusandae modi deleniti libero nostrud aute delectus quidem alias odio nostrum pariatur. placeat minus similique a aliquip facere ullamco officiis eligendi ad at magnam commodi maxime.
Adipisicing modi enim similique maxime ex nisi sed eu suscipit earum corrupti assumenda perferendis cumque maiores qui praesentium nobis. Sed voluptas consequatur voluptates rerum facilis qui dolor commodi minim provident, magnam facere, tenetur. Aliqua voluptatibus delectus illum dolorem excepturi aliquip duis odio. Excepturi similique hic iusto eu consectetur laboriosam quidem esse eiusmod, anim. Eu consequatur magnam tempor vel.
Nobis incididunt eius cum distinctio magnam velit facilis libero ullam, tenetur distinctio eius eveniet. Anim possimus expedita fugiat facilis vel consequatur in temporibus laboriosam at molestiae velit cupidatat. Vel consequatur voluptate cum sint dolores ullamco quas omnis quibusdam id officiis tenetur voluptas, tempore tenetur aliquam debitis. Nostrud, do in numquam magnam quia voluptate incidunt accusamus distinctio officia molestiae fuga. Nam corporis ex quos recusandae sed.
Ullamco incidunt cupidatat eos voluptate delectus nostrud nisi irure quod quis alias. Fuga quam autem mollit ex dolores quod non tempor mollitia quas labore sapiente a anim deserunt expedita minus. Ex pariatur accusamus alias deleniti quo, quia similique voluptas. In voluptatibus esse perferendis commodo aute repellendus accusamus laboriosam deserunt aute possimus laboriosam.
Labore hic tempora, ad iusto hic aliqua ducimus. Distinctio omnis tempore incididunt ut sed mollit, quidem, aute sunt eius eveniet, vel distinctio cupiditate eius atque. Fuga asperiores tenetur enim, provident similique aliqua nostrum ad dolorum, molestiae, repudiandae ad sunt. Consequatur ullamco a nisi aliqua non omnis officia.
Labore sapiente obcaecati libero quas eos incididunt. Saepe quas voluptas mollitia consectetur dolores dolores officiis id, quo, laboriosam reprehenderit alias. Voluptates cumque dignissimos, cumque dolor. Incididunt minima consectetur harum et.
1What if the text isn't symmetric? For example, the text of this comment in this question can't be palindromed as it has more than one letter that occurs an odd number of times, hence it can be flipped without duplicating a letter. – None – 2014-01-13T02:18:03.297
1Can you give an example input and output here? – jscs – 2014-01-13T04:33:16.327
2@LegoStormtroopr I believe that's what he means by "you may remove letters". My interpretation is: every character in that file is going into a bag, and you pull characters from the bag to create a palindrome? – Bob – 2014-01-13T05:10:53.053
5How will this be scored?
Length of palindrome
/Length of code
? – Bob – 2014-01-13T05:11:10.1031Please explain why you're emphasising you in "the longest palindrome you can programmatically create". – Peter Taylor – 2014-01-13T08:31:57.820
@Johnston, since you have tagged this as [tag:code-golf] then are you prepared to award the win to the shortest code, even if the palindrome it generates is extremely suboptimal? – Darren Stone – 2014-01-13T09:07:00.067
1I would suggest tightening up Rule 10 a bit. "Or something similar" is vague and you're already seeing submissions that are extremely short, generating extremely short palindromes. – Darren Stone – 2014-01-13T09:45:26.490
@JoshCaswell The Mathmatica answer below is a good example. – Johnston – 2014-01-13T11:58:58.620
1@Bob "...into a bag..." Exactly. Except that you may also discard letters you pick from the bag. – Johnston – 2014-01-13T12:00:14.280
@Bob: "How will this be scored?" Yes that is perfect.
Length of palindrome
/Length of code
. – Johnston – 2014-01-13T12:02:35.917@DarrenStone The scoring should fix that, no? Length of palindrome / Length of code. – Johnston – 2014-01-13T12:06:55.013
I'm still a bit confused. Is the winner the one with the highest score, or the lowest? Code golf is usually lowest score wins, but this scoring mechanism encourages very long programs which create extremely short palindromes - and that seems contrary to the intent of this challenge. – Iszi – 2014-01-13T14:41:13.223
@Iszi Highest score. Largest palindrome and shortest program. It encourages short programs with long palindromes. – Johnston – 2014-01-13T14:51:00.087
How does a score of
NaN
sort? – John Dvorak – 2014-01-13T15:51:03.100Why is this on hold and what do you mean
NaN
score?NaN
will be 0. Lowest score. How would you come toNaN
? Also what else is unclear? – Johnston – 2014-01-13T16:10:16.837You still haven't answered my question, so that's still unclear for a start. – Peter Taylor – 2014-01-13T16:23:09.750
@PeterTaylor: The objective is to find the longest palindrome with the least amount of code. I was attempting to point out that there is 1 palindrome that is longest by definition, but I will accept all palindromes, however the scoring will make smaller palindromes equate to less points. Emphasis on the word you was unnecessary and possibly confusing . I have unbolded the word "you". – Johnston – 2014-01-13T17:17:35.000
The spec still seems a bit confusing. Particularly: "A palindrome is a word, phrase, number, or other sequence of symbols." (not at all minding the fact that it's an incomplete definition to begin with) is self-contradictory when paired with several other portions of the challenge which specify that we're only dealing with letters and spaces. Which is it? Do we need to count for non-letter/space characters or not - and if so, which ones? – Iszi – 2014-01-13T17:21:35.570
In any case, the specification that the palindrome can be any combination of the characters in the given text input, without any regards to having the output make any sort of sense at all, makes this relatively trivial. Simply count the occurrence of each character, rounded down to the nearest even number, then output a string that has half of those occurrences sorted ascending followed by half of them descending. If you want to get a bonus point on length, take one of the odd characters and put it in the middle (though this may make your code long enough to nullify that bonus). – Iszi – 2014-01-13T17:23:54.970
@Johnston Looks like it's already done. I figured someone else had probably gotten ahead of me on that - just hadn't bothered to look yet.
– Iszi – 2014-01-13T17:29:44.167With this latest edit, your definition of a palindrome still remains incomplete. In fact, by explicitly stating that this incomplete definition is the one to be used for this challenge, one might simply echo the text as-is and be done because it is "a sequence of symbols". – Iszi – 2014-01-13T17:33:06.867
Per general StackExchange quality guidelines, shouldn't the Lorem Ipsum text be included in the question so that the question remains valid if the link goes dead? – Iszi – 2014-01-13T17:57:08.170