31
3
I was expecting to post something more complex as my first puzzle in PCG, but a particular, uh... homework question on Stack Overflow inspired me to post this. They want to:
print the following pattern for any given word that contains odd number of letters:
P M R A O R G O R R A P M
Notice that letters are a knight's move apart in the pattern you need to print. So, every other column is empty. -- (Thanks xnor for pointing this out.)
Rules
- Using C++ is prohibited. As I may link this question there.
- You may use
stdout
, or any means of quickly outputting a string (e.g.alert()
in JavaScript). - As always, shortest code wins.
Any restrictions around leading/trailing whitespace? – streetster – 2018-08-18T08:02:45.327
1@streetster No, none. Have a go at it :) – sampathsris – 2018-08-18T09:17:34.993
2
This is in the related posts on stack overflow: http://stackoverflow.com/q/5508110
– Level River St – 2014-10-29T11:26:21.277What do you mean by ODD? – flawr – 2014-10-29T14:20:08.803
2@flawr I think it means odd, as in not an even number. – NinjaBearMonkey – 2014-10-29T14:28:53.957
31God I am stupid, I thought it was kind of an obscure computer scientist abbreviation=) – flawr – 2014-10-29T14:34:57.263
Is the shortest answer measured in bytes or characters? – jpjacobs – 2014-10-29T15:43:55.277
2@jpjacobs: Bytes, unless the question explicitly says otherwise. – Dennis – 2014-10-29T17:20:35.290
2Whole program or just a function? (real smart of me to answer first and make this question later...) – Rodolfo Dias – 2014-10-29T20:23:49.103
2Notice that letters are a knight's move apart in the pattern you need to print. So, every other column is empty. – xnor – 2014-10-30T00:59:58.590
1@krumia Congrats on posting a solid question as a first-time poster on PPCG! I hope you stick around. – xnor – 2014-10-31T01:07:18.003
@xnor That's not a knight's move, it's an elephant's move.
– Lily Chung – 2014-11-01T23:08:43.9131I might be the first person in history to migrate a question here (although with some modifications). :D – sampathsris – 2014-11-01T23:47:33.720