当前位置:网站首页>7-7 ring the stupid bell
7-7 ring the stupid bell
2022-07-06 16:44:00 【HBUcs2020】
Topic link :PTA | Program design experiment auxiliary teaching platform
Mainly to investigate string Various uses of , The question is not difficult
// character string
// String search and replacement
#include<iostream>
using namespace std;
#include<string>
int main()
{
int n,pos1,pos2;
cin>>n;
getchar();
while(n--)
{
string s;
getline(cin,s);
pos1=s.find("ong,");
pos2=s.find("ong.");
if(pos1!=1&&pos2!=-1)
{
int count=0; // Record the number of spaces
int i;
for(i=s.length()-1; i>=0; i--)
{
if(s[i]==' ')
count++;
if(count==3)
break; // here i by ' ' The location of
}
s.replace(i,s.length()-i," qiao ben zhong");
cout<<s<<endl;
}
else
cout<<"Skipped"<<endl;
}
return 0;
}
边栏推荐
- One hundred questions of image processing (11-20)
- Kubernetes cluster deployment
- Educational Codeforces Round 122 (Rated for Div. 2)
- SF smart logistics Campus Technology Challenge (no T4)
- 第6章 Rebalance详解
- 解决Intel12代酷睿CPU单线程调度问题(二)
- Calculate the time difference
- Native JS realizes the functions of all selection and inverse selection -- Feng Hao's blog
- Simple records of business system migration from Oracle to opengauss database
- (lightoj - 1236) pairs forming LCM (prime unique decomposition theorem)
猜你喜欢
Install Jupiter notebook under Anaconda
解决Intel12代酷睿CPU【小核载满,大核围观】的问题(WIN11)
LeetCode 1558. Get the minimum number of function calls of the target array
Business system compatible database oracle/postgresql (opengauss) /mysql Trivia
新手必会的静态站点生成器——Gridsome
Kubernetes cluster deployment
sublime text 代码格式化操作
Browser print margin, default / borderless, full 1 page A4
Codeforces Round #802(Div. 2)A~D
Use JQ to realize the reverse selection of all and no selection at all - Feng Hao's blog
随机推荐
Codeforces - 1526C1&&C2 - Potions
Chapter 6 datanode
Raspberry pie 4B installation opencv3.4.0
Use JQ to realize the reverse selection of all and no selection at all - Feng Hao's blog
(lightoj - 1236) pairs forming LCM (prime unique decomposition theorem)
Browser print margin, default / borderless, full 1 page A4
LeetCode 1551. Minimum operand to make all elements in the array equal
(lightoj - 1354) IP checking (Analog)
One hundred questions of image processing (1-10)
原生js实现全选和反选的功能 --冯浩的博客
MP4格式详解
两个礼拜速成软考中级软件设计师经验
Hbuilder X格式化快捷键设置
简单尝试DeepFaceLab(DeepFake)的新AMP模型
Anaconda下安装Jupyter notebook
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
Study notes of Tutu - process
Cmake error: could not create named generator visual studio 16 2019 solution
QT simulates mouse events and realizes clicking, double clicking, moving and dragging
Business system compatible database oracle/postgresql (opengauss) /mysql Trivia