当前位置:网站首页>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;
}
边栏推荐
- Global and Chinese markets for industrial X-ray testing equipment 2022-2028: Research Report on technology, participants, trends, market size and share
- Interesting practice of robot programming 16 synchronous positioning and map building (SLAM)
- Four pits in reentrantlock!
- Actual combat simulation │ JWT login authentication
- Five ways to query MySQL field comments!
- 微信小程序:独立后台带分销功能月老办事处交友盲盒
- Lsblk command - check the disk of the system. I don't often use this command, but it's still very easy to use. Onion duck, like, collect, pay attention, wait for your arrival!
- Phpstrom setting function annotation description
- Li Kou Jianzhi offer -- binary tree chapter
- Codeforces Round #770 (Div. 2) ABC
猜你喜欢
Remote control service
Win: use PowerShell to check the strength of wireless signal
Exploration and Practice of Stream Batch Integration in JD
流批一體在京東的探索與實踐
如何搭建一支搞垮公司的技術團隊?
PowerShell: use PowerShell behind the proxy server
"2022" is a must know web security interview question for job hopping
微信小程序:独立后台带分销功能月老办事处交友盲盒
Runc hang causes the kubernetes node notready
Four pits in reentrantlock!
随机推荐
Yyds dry goods inventory [Gan Di's one week summary: the most complete and detailed in the whole network]; detailed explanation of MySQL index data structure and index optimization; remember collectio
MySQL backup and recovery + experiment
流批一体在京东的探索与实践
当产业互联网时代真正发展完善之后,将会在每一个场景见证巨头的诞生
When the industrial Internet era is truly developed and improved, it will witness the birth of giants in every scene
如何搭建一支搞垮公司的技术团队?
Do you know the eight signs of a team becoming agile?
Vulnstack3
Outlook:总是提示输入用户密码
力扣剑指offer——二叉树篇
Numpy library introductory tutorial: basic knowledge summary
Hedhat firewall
Wechat applet: wechat applet source code download new community system optimized version support agent member system function super high income
Four pits in reentrantlock!
Outlook: always prompt for user password
JS implementation determines whether the point is within the polygon range
La jeunesse sans rancune de Xi Murong
Phpstrom setting function annotation description
Kibana installation and configuration
JS implementation determines whether the point is within the polygon range