#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

int main ()
{
    std::vector<std::string> seq { "one", "zero", "two", "three", "zero", "four", "five" } ;
    const auto print = [&seq]
    { for( const auto& s : seq ) std::cout << s << ' ' ; std::cout << '\n' ; } ;
    print() ;

    // replace "zero" with "nil"
    const std::string zero = "zero" ;
    const std::string nil = "nil" ;
    std::replace( seq.begin(), seq.end(), zero, nil ) ;
    print() ;

    // replace strings which start with the character t with "ttttt" ;
    std::replace_if( seq.begin(), seq.end(),
                       []( const std::string& s ) { return !s.empty() && s[0] == 't' ; },
                       "ttttt" ) ;
    print() ;
}
