-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2.1.cpp
More file actions
53 lines (49 loc) · 1.16 KB
/
2.1.cpp
File metadata and controls
53 lines (49 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include<bits/stdc++.h>
using namespace std;
vector<string> ans;
// hi there
/* this is a
multiline cmt */
void removecomment(vector<string> inp){
bool multi = 0;
for(auto s : inp){
string out;
bool single = 0;
for(int i = 0; i < (int)s.size(); i++){
if(i + 1 < (int)s.size()){
if(s[i] == '/' && s[i+1] == '/'){
single = 1;
}
if(s[i] == '/' && s[i+1] == '*'){
multi = 1;
}
if(s[i] == '*' && s[i+1] == '/'){
multi = 0;
i+=2;
continue;
}
}
if(single || multi){
continue;
}
else {
out += s[i];
}
}
ans.push_back(out);
}
}
int main(){
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
string s;
bool single = 0, multi = 0;
vector<string> inp;
while(getline(cin,s)){
inp.push_back(s);
}
removecomment(inp);
for(auto i : ans){
cout << i << '\n';
}
}