-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.cpp
67 lines (54 loc) · 1.37 KB
/
code.cpp
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <bits/stdc++.h>
using namespace std ;
string line_parser(string str)
{
string ret = "";
bool nonEmpty = 0;
for(int i = 1; i < str.size(); i++){
if(str[i] == ' ' or str[i] == '\t' and nonEmpty){
ret += str[i] ;
}
else if(str[i] == ' ' or str[i] == '\t') {
continue;
}
else {
nonEmpty = 1;
ret += str[i] ;
}
}
return ret;
}
int main()
{
ifstream in;
ofstream out;
in.open("ss.txt");
out.open("sample.txt");
string line1,line2,line3, outstring = "";
if(in.fail())
{
cout<<"your file didn't work";
}
else {
while(getline(in,line1)){
string conc = "";
//cout << line_parser(line1) << endl;
getline(in,line2);
line2.erase(0,20) ;
getline(in,line3);
//if()
line1 = line_parser(line1);
line2 = line_parser(line2);
line3 = line_parser(line3);
conc = line1 +"###"+ line2 +"###" +line3;
//cout << line1 << endl;
if(line3 != "No Post Title"){
out<< conc << endl;
}
getline(in,line3);
}
in.close();
out.close();
}
return 0;
}