First was a PERL golf, then a PHP golf (when I found and partook in it). Since this section seems to be dead and going no where I'll host a game of golf.
Remember you need to be able to explain your solution to others so dont waste coding time googling for the perl solutions.
ALL ENTRIES MUST BE IN BY MONDAY MAY/31/2004 12:pm central time
PM me your answer function.
Challenge
There are two columns of words. Left-justify the left column, and right-justify the right column, then squeeze as many spaces as possible out from between them while keeping at least one space on every line and keeping the justifications.
So with the function input:
Your function should return:Code:waf zrsea abdef sedrgf a warfhjik
Code:waf zrsea abdef sedrgf a warfhjik
Challenge Rules
Input will be in a single string, no more than 10 lines, with two words separated by one space. Maximum word length is 10. Output should be the same but with "(space)+" instead of "(space)".
Challenge Specific Requirements
1) Function will take one parameter, a string
2) Function will return a string
C++ Golf Rules
It's pretty simple if you haven't played code golf before; shortest solution in characters that solves the challenge and meets the challenge rules wins.
1. Solutions in C/C++ only. Free to use classes, but it will likely increase your code. ++ has been added simply for header librarys
2. You can only use the standard C/C++ headers
3. Because C++ often has one shortest solution, only post your golf score until the round is declared over.
2. Your solution must be contained in a single function and your solution must be contained within the scope of the function (i.e. defining vars outside your function and using 'global a,b,c;' would not be ok.)
3. You golf score includes the function definition and all spaces. i.e.
#234567890123456
string j(string s) {} # golf score of 15
HAVE FUN - Even if you dont think you'll win have a go and see how you shape up.