There is no "best" way. There is not even a remotely acceptable way.
- SLoC (and related measurements, like character count) are utterly meaningless; refer to Wikipedia for a summary of the most common criticisms
- if you want a more abstract thing to count, like "atomic elements" of the program, you got to decide what you consider such - and many will disagree, rightfully so, because this matter is mostly undecidable
- Also, such comparisions are rarley fair because most of them use example problems that tend to be solved more naturally in one language or the other. Every tried implementing an Accumulator Factory in C++? Now remember that the problem was proposed by a Lisp advocate (Paul Graham)...
- Moreover, many would argue that really clever solution which uses very few lines/characters/"atomic elements" isn t the best solution in any otherway - look at code golf
All things considered, the best solution might be taking many different real-world problems, solving them idiomatically in different languages, and just informally looking at the source and deciding which looks more elegant.