#include <iostream>
#include <sstream>
#include <string>
#include <vector>
std::istringstream in(
"Steven Seagal\n"
"1234 Post Drive\n"
"Ventura, CA 90734\n"
"\n"
"Adam Sandler\n"
"356 Golf Street\n"
"Calabasas, CA 92136\n"
);
int main()
{
std::vector<std::vector<std::string>> lines ;
std::string line ;
while (std::getline(in, line))
{
std::vector<std::string> tokens ;
std::istringstream ls(line) ;
std::string token ;
while ( ls >> token )
tokens.push_back(token) ;
if ( tokens.size() ) // skip empty lines.
lines.emplace_back(std::move(tokens)) ;
}
for ( auto& line : lines )
{
for ( auto& token : line )
std::cout << token << ' ' ;
std::cout << '\n';
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3N0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPHZlY3Rvcj4KCnN0ZDo6aXN0cmluZ3N0cmVhbSBpbigKCSJTdGV2ZW4gU2VhZ2FsXG4iCgkiMTIzNCBQb3N0IERyaXZlXG4iCgkiVmVudHVyYSwgQ0EgOTA3MzRcbiIKCSJcbiIKCSJBZGFtIFNhbmRsZXJcbiIKCSIzNTYgR29sZiBTdHJlZXRcbiIKCSJDYWxhYmFzYXMsIENBIDkyMTM2XG4iCik7CgppbnQgbWFpbigpCnsKCXN0ZDo6dmVjdG9yPHN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPj4gbGluZXMgOwoJCglzdGQ6OnN0cmluZyBsaW5lIDsKCXdoaWxlIChzdGQ6OmdldGxpbmUoaW4sIGxpbmUpKQoJewoJCXN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPiB0b2tlbnMgOwoJCXN0ZDo6aXN0cmluZ3N0cmVhbSBscyhsaW5lKSA7CgkJc3RkOjpzdHJpbmcgdG9rZW4gOwoJCQoJCXdoaWxlICggbHMgPj4gdG9rZW4gKQoJCQl0b2tlbnMucHVzaF9iYWNrKHRva2VuKSA7CgkJCQoJCWlmICggdG9rZW5zLnNpemUoKSApCQkvLyBza2lwIGVtcHR5IGxpbmVzLgoJCQlsaW5lcy5lbXBsYWNlX2JhY2soc3RkOjptb3ZlKHRva2VucykpIDsKCX0KCQoJZm9yICggYXV0byYgbGluZSA6IGxpbmVzICkKCXsKCQlmb3IgKCBhdXRvJiB0b2tlbiA6IGxpbmUgKQoJCQlzdGQ6OmNvdXQgPDwgdG9rZW4gPDwgJyAnIDsKCQlzdGQ6OmNvdXQgPDwgJ1xuJzsKCX0KfQ==