Given a source code in C++. Print the source code after cleaning it as follows : 1. If there are comments you have to remove them all whether it's a single comment (e.g. : //) or a block comment (e.g.: /**/). 2. If there are any blank lines or lines consists of spaces you must remove them all.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
|%Y0 l. lin. e
Z. Clean Code
time limit per test: 1 seconde
memory limit per test: 256 megabytes
input: standard input
output: standard output
Given a source code in C++. Print the source code after cleaning it as follows :
1. If there are comments you have to remove them all whether it's a single
comment (e.g. : //) or a block comment (e.g.: /**/).
2. If there are any blank lines or lines consists of spaces you must remove them
all.
See the test cases carefully for more clarifications.
Input
Source code in C++ (maximum number of lines is 50).
Output
Print the clean code according to the problem statement.
Example
input
Соpy
// I am a single comment and you must remove me : ((
I am a block comment and you must remove me
* /
#include<iostream>
using namespace std;
int main () {
int a, b;
cin
a » b; // Reading two variables from user (please remove
>>
me !! :
cout «
а + b « endl:
// End of the program (remove me please :) )
return 0 ;
output
Соpy
#include<iostream>
using namespace std;
int main () {
int a, b ;
cin » a » b;
cout
« а + b « endl;
return 0;
}
Note
Please be careful in handling the priority of comments.
Comment symbols may be included in comments and it's not guaranteed that the
resulting source code is a valid C++ syntax.
Codeforces (c) Copvriaht 2010-2021 Mike Mirzavanov
II
>
Transcribed Image Text:|%Y0 l. lin. e Z. Clean Code time limit per test: 1 seconde memory limit per test: 256 megabytes input: standard input output: standard output Given a source code in C++. Print the source code after cleaning it as follows : 1. If there are comments you have to remove them all whether it's a single comment (e.g. : //) or a block comment (e.g.: /**/). 2. If there are any blank lines or lines consists of spaces you must remove them all. See the test cases carefully for more clarifications. Input Source code in C++ (maximum number of lines is 50). Output Print the clean code according to the problem statement. Example input Соpy // I am a single comment and you must remove me : (( I am a block comment and you must remove me * / #include<iostream> using namespace std; int main () { int a, b; cin a » b; // Reading two variables from user (please remove >> me !! : cout « а + b « endl: // End of the program (remove me please :) ) return 0 ; output Соpy #include<iostream> using namespace std; int main () { int a, b ; cin » a » b; cout « а + b « endl; return 0; } Note Please be careful in handling the priority of comments. Comment symbols may be included in comments and it's not guaranteed that the resulting source code is a valid C++ syntax. Codeforces (c) Copvriaht 2010-2021 Mike Mirzavanov II >
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education