#include<iostream>
#include<string>
using namespace std;
int main(){
std::string str ("/home/docs/awp/awp/3/5/1/awp_awp.ch_20110504_1351_1-1351.html /home/docs/awp/awg/6/9/1/awp_awp.ch_20130404_691_1-691.xml /home/docs/awp/awp/6/9/1/awp_awp.ch_20130404_691_1-691.xml /home/docs/awp/awp/6/9/1/awp/awp.ch_20130404_691_1-691.xml ");
std::string oldStr("awp/awp");
std::string newStr ("awp/awg");
size_t pos = 0;
while((pos = str.find(oldStr, pos)) != std::string::npos)
{
str.replace(pos, oldStr.length(), newStr);
pos += newStr.length();
}
cout<<str<<endl;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPHN0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CiAgICBzdGQ6OnN0cmluZyBzdHIgKCIvaG9tZS9kb2NzL2F3cC9hd3AvMy81LzEvYXdwX2F3cC5jaF8yMDExMDUwNF8xMzUxXzEtMTM1MS5odG1sIC9ob21lL2RvY3MvYXdwL2F3Zy82LzkvMS9hd3BfYXdwLmNoXzIwMTMwNDA0XzY5MV8xLTY5MS54bWwgIC9ob21lL2RvY3MvYXdwL2F3cC82LzkvMS9hd3BfYXdwLmNoXzIwMTMwNDA0XzY5MV8xLTY5MS54bWwgL2hvbWUvZG9jcy9hd3AvYXdwLzYvOS8xL2F3cC9hd3AuY2hfMjAxMzA0MDRfNjkxXzEtNjkxLnhtbCAiKTsKICAgIHN0ZDo6c3RyaW5nIG9sZFN0cigiYXdwL2F3cCIpOwogICAgc3RkOjpzdHJpbmcgbmV3U3RyICgiYXdwL2F3ZyIpOwogICAgc2l6ZV90IHBvcyA9IDA7CiAgICAgd2hpbGUoKHBvcyA9IHN0ci5maW5kKG9sZFN0ciwgcG9zKSkgIT0gc3RkOjpzdHJpbmc6Om5wb3MpCiAgewogICAgIHN0ci5yZXBsYWNlKHBvcywgb2xkU3RyLmxlbmd0aCgpLCBuZXdTdHIpOwogICAgIHBvcyArPSBuZXdTdHIubGVuZ3RoKCk7CiAgfQogICAgY291dDw8c3RyPDxlbmRsOwp9