当前位置:网站首页>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;
}
边栏推荐
- Database postragesql lock management
- MATLB|多微电网及分布式能源交易
- [swagger]-swagger learning
- 如何搭建一支搞垮公司的技術團隊?
- Global and Chinese markets of radiation linear accelerators 2022-2028: Research Report on technology, participants, trends, market size and share
- Pytorch fine tuning (Fortune): hollowed out design or cheating
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- Main window in QT application
- Database postragesq peer authentication
- Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
猜你喜欢
Exploration and practice of integration of streaming and wholesale in jd.com
Behind the cluster listing, to what extent is the Chinese restaurant chain "rolled"?
Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
Mysql database | build master-slave instances of mysql-8.0 or above based on docker
Express routing, express middleware, using express write interface
[flutter topic] 64 illustration basic textfield text input box (I) # yyds dry goods inventory #
Phpstrom setting function annotation description
小程序容器技术与物联网 IoT 可以碰撞出什么样的火花
Interesting practice of robot programming 14 robot 3D simulation (gazebo+turtlebot3)
One plus six brushes into Kali nethunter
随机推荐
MySQL REGEXP:正则表达式查询
Yyds dry inventory jetpack hit dependency injection framework Getting Started Guide
微信小程序:最新wordpress黑金壁纸微信小程序 二开修复版源码下载支持流量主收益
Are you still writing the TS type code
Complex, complicated and numerous: illustration of seven types of code coupling
Win: add general users to the local admins group
Wechat applet: the latest WordPress black gold wallpaper wechat applet two open repair version source code download support traffic main revenue
[OpenGL learning notes 8] texture
Interpretation of mask RCNN paper
Wechat applet: new independent backstage Yuelao office one yuan dating blind box
Global and Chinese market of nutrient analyzer 2022-2028: Research Report on technology, participants, trends, market size and share
Win:使用 PowerShell 检查无线信号的强弱
Educational Codeforces Round 122 (Rated for Div. 2) ABC
Valentine's Day flirting with girls to force a small way, one can learn
batchnorm.py这个文件单GPU运行报错解决
Jcenter () cannot find Alibaba cloud proxy address
Tla+ through examples (XI) -- propositional logic and examples
Game 280 of leetcode week
Global and Chinese market of optical densitometers 2022-2028: Research Report on technology, participants, trends, market size and share
Kibana installation and configuration