#include <iostream>
#include <string>
#include <vector>
int main ( )
{
std:: string str( "This is a test string" ) ;
std:: cout << "str = \" " << str << "\" \n " ;
std:: vector < size_t > t;
for ( size_t n = str.find_first_of ( "tT" ) ; n ! = std:: string :: npos ;
n = str.find_first_of ( "tT" , n+ 1 ) )
{
std:: cout << '\' ' << str[ n] << "' found at position " << n << ";\n " ;
t.push_back ( n) ;
}
std:: cout << "Searching complete\n "
<< "int t[" << t.size ( ) << "] = {" ;
if ( ! t.empty ( ) )
{
for ( size_t n = 0 ; n < t.size ( ) - 1 ; ++ n)
std:: cout << t[ n] << ", " ;
std:: cout << * t.rbegin ( ) ;
}
std:: cout << "}\n " ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dmVjdG9yPgppbnQgbWFpbiAoKQp7CiAgICBzdGQ6OnN0cmluZyBzdHIoIlRoaXMgaXMgYSB0ZXN0IHN0cmluZyIpOwogICAgc3RkOjpjb3V0IDw8ICJzdHIgPSBcIiIgPDwgc3RyIDw8ICJcIlxuIjsgCiAgICBzdGQ6OnZlY3RvcjxzaXplX3Q+IHQ7CiAgICBmb3Ioc2l6ZV90IG4gPSBzdHIuZmluZF9maXJzdF9vZigidFQiKTsgbiAhPSBzdGQ6OnN0cmluZzo6bnBvczsKICAgICAgICAgICAgICAgbiA9IHN0ci5maW5kX2ZpcnN0X29mKCJ0VCIsIG4rMSkpCiAgICB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICdcJycgPDwgc3RyW25dIDw8ICInIGZvdW5kIGF0IHBvc2l0aW9uICIgPDwgbiA8PCAiO1xuIjsKICAgICAgICB0LnB1c2hfYmFjayhuKTsKICAgIH0KCiAgICBzdGQ6OmNvdXQgPDwgIlNlYXJjaGluZyBjb21wbGV0ZVxuIgogICAgICAgICAgICAgIDw8ICJpbnQgdFsiIDw8IHQuc2l6ZSgpIDw8ICJdID0geyI7CiAgICBpZighdC5lbXB0eSgpKQogICAgewogICAgICAgIGZvcihzaXplX3QgbiA9IDA7IG4gPCB0LnNpemUoKS0xOyArK24pCiAgICAgICAgICAgIHN0ZDo6Y291dCA8PCB0W25dIDw8ICIsICI7CiAgICAgICAgc3RkOjpjb3V0IDw8ICp0LnJiZWdpbigpOwogICAgfQogICAgc3RkOjpjb3V0IDw8ICJ9XG4iOwp9Cg==