当前位置:网站首页>Word processing software
Word processing software
2022-07-05 01:42:00 【Stars are not last night 334】
Title Description
You need to develop a word processing software . At the beginning, enter a string ( No more than 100 Characters ) As the initial document . It can be considered that the beginning of the document is 0 Characters . The following operations need to be supported :
1 str: Followed by insertion , Insert a string after the document str, And output the string of the document .2 a b: Intercept the document part , Only keep documents from a Start with two characters b Characters , And output the string of the document .3 a str: Insert clip , In the document, section a Insert a string before characters str, And output the string of the document .4 str: Find substring , Find string str In the first place in the document and output ; If the output cannot be found -1.
To simplify the problem , Specify the initial document and the... In each operation str There are no spaces or line breaks . There will be at most q(q≤100) operations .
Input format
nothing
Output format
nothing
I/o sample
Input #1 Copy
4 ILove 1 Luogu 2 5 5 3 3 guGugu 4 gu
Output #1 Copy
ILoveLuogu Luogu LuoguGugugu 3
#include<iostream>
#include<cmath>
#include<string>
#include<fstream>
using namespace std;
int n,a;
string qwq;
string c1;
string b1;
int b,c,d=-1,e;// Not all useful
int main()
{
cin>>n;
cin>>qwq;
for(int i=0;i<n;i++)
{
cin>>a;
if(a==1)// operation 1
{
cin>>b1;
qwq+=b1;
cout<<qwq<<endl;
}
else if(a==2)// operation 2
{
cin>>b>>c;
c1=qwq.substr(b,c);
qwq=c1;
cout<<qwq;
cout<<endl;
}
else if(a==3)// operation 3
{
cin>>b>>b1;
qwq.insert(b,b1);
cout<<qwq<<endl;
}
else if(a==4)// operation 4
{
cin>>b1;
if(qwq.find(b1)<qwq.size())// If it cannot be found, it will return a strange number ( It's longer than the string anyway )
cout<<qwq.find(b1)<<endl;
else
cout<<-1<<endl;
}
}
return 0;
}
边栏推荐
- Wechat applet: independent background with distribution function, Yuelao office blind box for making friends
- Restful fast request 2022.2.1 release, support curl import
- Win:将一般用户添加到 Local Admins 组中
- Unified blog writing environment
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- The server time zone value ‘� й ��� ʱ 'is unrecognized or representatives more than one time zone【
- Database postragesq PAM authentication
- PHP wechat official account development
- es使用collapseBuilder去重和只返回某个字段
- What sparks can applet container technology collide with IOT
猜你喜欢

小程序容器技术与物联网 IoT 可以碰撞出什么样的火花

微信小程序:独立后台带分销功能月老办事处交友盲盒
![[development of large e-commerce projects] performance pressure test - Optimization - impact of middleware on performance -40](/img/e4/0bdee782a65028b2bc87db85d48738.png)
[development of large e-commerce projects] performance pressure test - Optimization - impact of middleware on performance -40

The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety

How to safely eat apples on the edge of a cliff? Deepmind & openai gives the answer of 3D security reinforcement learning

Exploration and Practice of Stream Batch Integration in JD

MySQL backup and recovery + experiment

R语言用logistic逻辑回归和AFRIMA、ARIMA时间序列模型预测世界人口

Main window in QT application

After reading the average code written by Microsoft God, I realized that I was still too young
随机推荐
Valentine's Day flirting with girls to force a small way, one can learn
Great God developed the new H5 version of arXiv, saying goodbye to formula typography errors in one step, and mobile phones can also easily read literature
Robley's global and Chinese markets 2022-2028: technology, participants, trends, market size and share Research Report
Runc hang causes the kubernetes node notready
Tla+ through examples (XI) -- propositional logic and examples
Wechat applet; Gibberish generator
Win: enable and disable USB drives using group policy
Introduction to the gtid mode of MySQL master-slave replication
How to build a technical team that will bring down the company?
增量备份 ?db full
Four pits in reentrantlock!
pytorch fine-tuning (funtune) : 镂空设计or 偷梁换柱
Exploration and practice of integration of streaming and wholesale in jd.com
MySQL regexp: Regular Expression Query
Global and Chinese market of veterinary thermometers 2022-2028: Research Report on technology, participants, trends, market size and share
Five ways to query MySQL field comments!
MATLB|多微电网及分布式能源交易
PowerShell: use PowerShell behind the proxy server
Express routing, express middleware, using express write interface
微信小程序:全新独立后台月老办事处一元交友盲盒