64,654
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include <string>
int main()
{
using namespace std;
string str;
cin>>str;
try
{
string::size_type pos;
cout<<
str.replace((pos = str.find_first_of("a"), (pos == string::npos ? throw 0 : pos)), 1, "xyz").insert(str.size() + 1, "this is my work").size()
<<endl<<str<<endl;
}
catch(int)
{
cout<<str.insert(str.size() - 1, "this is my work").size()<<endl<<str<<endl;
}
}