diff --git a/src/main.cpp b/src/main.cpp
index 3476398..b9d6a05 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,7 +30,10 @@ Input getInput(int day, string key, bool useTestInput, int testFetchIndex) {
string res = cpr::Get(cpr::Url{url}).text;
size_t i1 = findAll(res, "")[testFetchIndex];
size_t i2 = findAll(res, "
")[testFetchIndex];
- file << res.substr(i1 + 6, i2 - (i1 + 6));
+ string codeContent = res.substr(i1 + 6, i2 - (i1 + 6));
+ removeAll(codeContent, "");
+ removeAll(codeContent, "");
+ file << codeContent;
file.close();
}
}
diff --git a/src/util.h b/src/util.h
index c369cce..e329b32 100644
--- a/src/util.h
+++ b/src/util.h
@@ -30,4 +30,11 @@ inline vector findAll(const string& data, const string& toSearch){
}
return indices;
+}
+
+inline void removeAll(string& data, const string& toRemove) {
+ vector indices = findAll(data, toRemove);
+ std::sort(indices.rbegin(), indices.rend());
+ for (size_t &i : indices)
+ data.erase(i, toRemove.size());
}
\ No newline at end of file