#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
std::vector<std::string> foo;
foo.push_back("A");
foo.push_back("B");
std::string::size_type total = 0;
std::accumulate(foo.begin(), foo.end(), total,
[](std::string::size_type i, std::string const& s) { return i + s.size(); });
cout << total << endl;
std::string result;
result.reserve(total);
std::for_each(foo.begin(), foo.end(),
[&](std::string const& s) { result += s; });
cout << result << endl;
return 0;
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dmVjdG9yPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCmludCBtYWluKCkgewoJc3RkOjp2ZWN0b3I8c3RkOjpzdHJpbmc+IGZvbzsKCWZvby5wdXNoX2JhY2soIkEiKTsKCWZvby5wdXNoX2JhY2soIkIiKTsKCXN0ZDo6c3RyaW5nOjpzaXplX3R5cGUgdG90YWwgPSAwOwogICAgc3RkOjphY2N1bXVsYXRlKGZvby5iZWdpbigpLCBmb28uZW5kKCksIHRvdGFsLCAKICAgICAgICAgICAgICAgICAgICBbXShzdGQ6OnN0cmluZzo6c2l6ZV90eXBlIGksIHN0ZDo6c3RyaW5nIGNvbnN0JiBzKSB7IHJldHVybiBpICsgcy5zaXplKCk7IH0pOwogICAgY291dCA8PCB0b3RhbCA8PCBlbmRsOwogICAgc3RkOjpzdHJpbmcgcmVzdWx0OwogICAgcmVzdWx0LnJlc2VydmUodG90YWwpOwogICAgc3RkOjpmb3JfZWFjaChmb28uYmVnaW4oKSwgZm9vLmVuZCgpLCAKICAgICAgICAgICAgICAgICAgWyZdKHN0ZDo6c3RyaW5nIGNvbnN0JiBzKSB7IHJlc3VsdCArPSBzOyB9KTsKICAgIGNvdXQgPDwgcmVzdWx0IDw8IGVuZGw7CglyZXR1cm4gMDsKfQ==