Worth +6 to Complete Programming skill.
In a sentence (at least a properly formatted sentence) there may be parentheses (these things) that present extra information (and don't forget that (sometimes) it is useful to have parentheses inside of parentheses).
Task: Create C a program parens
that reads lines of text from standard in (use parens.c as a starting point).
As part of the code, there should be a method called parenthesize(char* s)
that first prints the string s
(with a newline at the end) and then identifies all substrings inside one level of parentheses.
It then calls parenthesize
on these substrings.
Example Input:
This is just a line. This is (a bit) more than a line. Sometimes (such as (now)) there can (may) be multiple (many (many (many))) parentheses.
Example Output:
This is just a line. This is (a bit) more than a line. a bit Sometimes (such as (now)) there can (may) be multiple (many (many (many))) parentheses. such as (now) now may many (many (many)) many (many) many