#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;
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;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKYm9vbCBNYWtlSG9nZShzdGQ6OnN0cmluZyBTdHIpewoJaW50IFNQID0gMDsKCWZvciAoc3RkOjpzaXplX3QgaSA9IDA7IGkrU1AgPCBTdHIuc2l6ZSgpOyBpKyspewoJCWlmIChTdHJbaSArIFNQXSA9PSAnICcpU1ArKzsKCQlpZiAoKGkpICUgMiA9PSAwKXN0ZDo6Y291dCA8PCBTdHJbaSArIFNQXSA8PCAnICc7Cgl9CglzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwoJU1AgPSAwOwoJZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaStTUCA8IFN0ci5zaXplKCk7IGkrKyl7CgkJaWYgKFN0cltpICsgU1BdID09ICcgJylTUCsrOwoJCWlmICgoaSkgJSAyID09IDEpc3RkOjpjb3V0IDw8IFN0cltpICsgU1BdIDw8ICcgJzsKCX0KCXN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7CglyZXR1cm4gdHJ1ZTsKfQoKaW50IG1haW4oKXsKCXN0ZDo6c3RyaW5nIFN0cjE9ICIxMjM0NTY3ODkiOwoJc3RkOjpzdHJpbmcgU3RyMiA9ICJUaGUgZWFydGggdHVybnMgYXJvdW5kIHRoZSBzdW4uIjsKCXN0ZDo6c3RyaW5nIFN0cjMgPSAid2Egd2Egd2EgdyB3IC4iOwoKCU1ha2VIb2dlKFN0cjEpOwoJTWFrZUhvZ2UoU3RyMik7CglNYWtlSG9nZShTdHIzKTsKCglyZXR1cm4gMDsKfQ==