#include <iostream>
#include <string>
bool MakeHoge(std::string Str){
int SP = 0;
for (std::size_t i = 0; i+SP < Str.size(); i++){
if (Str[i + SP] == ' ')SP++;
if ((i) % 2 == 0)std::cout << Str[i + SP] << ' ';
}
std::cout << std::endl;
std::cout << ' ';
SP = 0;
for (std::size_t i = 0; i+SP < Str.size(); i++){
if (Str[i + SP] == ' ')SP++;
if ((i) % 2 == 1)std::cout << Str[i + SP] << ' ';
}
std::cout << std::endl;
return true;
}
int main(){
std::string Str1= "123456789";
std::string Str2 = "The earth turns around the sun.";
std::string Str3 = "wa wa wa w w .";
MakeHoge(Str1);
MakeHoge(Str2);
MakeHoge(Str3);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKYm9vbCBNYWtlSG9nZShzdGQ6OnN0cmluZyBTdHIpewoJaW50IFNQID0gMDsKCWZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkrU1AgPCBTdHIuc2l6ZSgpOyBpKyspewoJCWlmIChTdHJbaSArIFNQXSA9PSAnICcpU1ArKzsKCQlpZiAoKGkpICUgMiA9PSAwKXN0ZDo6Y291dCA8PCBTdHJbaSArIFNQXSA8PCAnICc7Cgl9CglzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwoJc3RkOjpjb3V0IDw8ICcgJzsKCVNQID0gMDsKCWZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkrU1AgPCBTdHIuc2l6ZSgpOyBpKyspewoJCWlmIChTdHJbaSArIFNQXSA9PSAnICcpU1ArKzsKCQlpZiAoKGkpICUgMiA9PSAxKXN0ZDo6Y291dCA8PCBTdHJbaSArIFNQXSA8PCAnICc7Cgl9CglzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwoJcmV0dXJuIHRydWU7Cn0KCmludCBtYWluKCl7CglzdGQ6OnN0cmluZyBTdHIxPSAiMTIzNDU2Nzg5IjsKCXN0ZDo6c3RyaW5nIFN0cjIgPSAiVGhlIGVhcnRoIHR1cm5zIGFyb3VuZCB0aGUgc3VuLiI7CglzdGQ6OnN0cmluZyBTdHIzID0gIndhIHdhIHdhIHcgdyAuIjsKCglNYWtlSG9nZShTdHIxKTsKCU1ha2VIb2dlKFN0cjIpOwoJTWFrZUhvZ2UoU3RyMyk7CgoJcmV0dXJuIDA7Cn0=