r/dailyprogrammer • u/mattryan • Apr 19 '12
[4/19/2012] Challenge #41 [easy]
Write a program that will accept a sentence as input and then output that sentence surrounded by some type of an ASCII decoratoin banner.
Sample run:
Enter a sentence: So long and thanks for all the fish
Output
*****************************************
* *
* So long and thanks for all the fish *
* *
*****************************************
Bonus: If the sentence is too long, move words to the next line.
16
Upvotes
2
u/prophile Apr 19 '12
Done in Python:
2
u/luxgladius 0 0 Apr 19 '12
Perl
Output
2
u/drb226 0 0 Apr 19 '12
Haskell:
2
u/huck_cussler 0 0 Apr 20 '12
No wrap, yet. In Java:
2
u/frombih Apr 23 '12 edited Apr 23 '12
I am just starting to learn java.. Could have wrote it with less code, but I wanted to practice a bit..
Sorry, my first post, formatting sucks..
output:
1
u/[deleted] Apr 19 '12
Perl with bonus using regex
1
u/Daniel110 0 0 Apr 23 '12
Python, any inputs on how to improve it?
1
u/[deleted] Apr 23 '12
Done in C:
Output:
1
u/joeyGibson Apr 26 '12
This is my version in Clojure. The simple version, which does no wrapping, is only 9 lines. The wrapping version is considerably longer, but it handles really long strings, and tries to break on a space.
Output:
1
u/whydoyoulook 0 0 May 02 '12
My solution in Java. No wrapping. Feedback appreciated.
1
u/school_throwaway Apr 19 '12
python: