#include <string>
#include <iostream>
#include <algorithm>
std::string removeNewlines(std::string s) {
s.erase(std::remove(s.begin(), s.end(), '\n'), s.end());
s.erase(std::remove(s.begin(), s.end(), '\r'), s.end());
return s;
}
int main() {
std::string s = "c++\n java\r python\ngo\n";
s = removeNewlines(s);
std::cout << s << "\n";
}
/*
run:
c++ java pythongo
*/