DIY: Count a Word in the Comments
Explore how to extract comments from C++ source code and count precise instances of a given word within those comments. This lesson guides you in developing a function that parses code lines to differentiate code from comments and accurately tally occurrences, enhancing problem-solving skills relevant to coding interviews.
We'll cover the following...
We'll cover the following...
Problem statement
In this challenge, you are given two arguments: a list of strings containing lines of a C++ source code and a string containing a word. Your task is to identify which parts of the code are comments, and then count all occurrences of the input word present in the comments ...