I have just been reading a debate as to whether it is best to learn C or C++.
While i am not too interested in which is best i am shocked by the amount of code required to perform a simple task
As this debate went on one individual lay down the gauntlet to try to prove that C++ was more compact and faster.
His challenge was this:-
Write a program that reads text from standard-input, and returns (prints) the total number of distinct words found in the text
The text file was 55,704,078 bytes in size and contains 6,727,317 words in total. It holds 576,059 distinct words
The web page is at should you be interested
I simply wondered how minimal and speedy the code could be from a UNIX scripting guru
Well - if any of you are up for the challenge!?
While i am not too interested in which is best i am shocked by the amount of code required to perform a simple task
As this debate went on one individual lay down the gauntlet to try to prove that C++ was more compact and faster.
His challenge was this:-
Write a program that reads text from standard-input, and returns (prints) the total number of distinct words found in the text
The text file was 55,704,078 bytes in size and contains 6,727,317 words in total. It holds 576,059 distinct words
The web page is at should you be interested
I simply wondered how minimal and speedy the code could be from a UNIX scripting guru
Well - if any of you are up for the challenge!?