#include <iostream>
#include <sstream>
int main() {
std::string input = "firstline\nsecondline\n\nthirdline\nfourthline";
std::stringstream ss(input);
std::string line;
while(std::getline(ss, line))
{
if( line != "")
std::cout << line << std::endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KCmludCBtYWluKCkgewogICAgICAgIHN0ZDo6c3RyaW5nIGlucHV0ID0gImZpcnN0bGluZVxuc2Vjb25kbGluZVxuXG50aGlyZGxpbmVcbmZvdXJ0aGxpbmUiOwogICAgICAgIHN0ZDo6c3RyaW5nc3RyZWFtIHNzKGlucHV0KTsKICAgICAgICBzdGQ6OnN0cmluZyBsaW5lOwogICAgICAgIHdoaWxlKHN0ZDo6Z2V0bGluZShzcywgbGluZSkpCiAgICAgICAgewogICAgICAgICAgIGlmKCBsaW5lICE9ICIiKQogICAgICAgICAgICAgICAgIHN0ZDo6Y291dCA8PCBsaW5lIDw8IHN0ZDo6ZW5kbDsKICAgICAgICB9CglyZXR1cm4gMDsKfQ==