题目链接:https://www.luogu.com.cn/problem/P5734
思路:
运用C++的四个函数就好了
①append函数,在原字符串后添加字符串
官方介绍:https://cplusplus.com/reference/string/string/append/
这是官方给的例子:
// appending to string
#include <iostream>
#include <string>
int main ()
{
std::string str;
std::string str2="Writing ";
std::string str3="print 10 and then 5 more";
// used in the same order as described above:
str.append(str2);

本文介绍了C++中用于字符串操作的四个关键函数:append用于追加字符串,substr用于提取子字符串,insert用于在指定位置插入字符串,find用于查找子字符串出现的位置。并通过示例代码展示了这些函数的用法。

636

被折叠的 条评论
为什么被折叠?



