Skip to content
C

Strip Line Comments

Mediumjava

Given lines of pretend source code, remove any // line comment from each line (everything from the first // to the end of the line), trim trailing spaces, and print the lines that still have content.

Assume // never appears inside a string literal.

Input: the first line is an integer N; then N lines of text.

Output: for each line, the code part with its // comment removed and trailing spaces trimmed — but skip lines that become empty.

Input (stdin)

Output

Run your code to see output here...