当前位置:网站首页>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;
}
边栏推荐
- 解决Intel12代酷睿CPU【小核载满,大核围观】的问题(WIN11)
- 新手必会的静态站点生成器——Gridsome
- Cmake Express
- Li Kou: the 81st biweekly match
- Solve the problem that intel12 generation core CPU single thread only runs on small cores
- China double brightening film (dbef) market trend report, technical dynamic innovation and market forecast
- Hbuilder X格式化快捷键设置
- 图像处理一百题(11-20)
- Sublime text code formatting operation
- Codeforces Round #802(Div. 2)A~D
猜你喜欢
It is forbidden to trigger onchange in antd upload beforeupload
Solve the problem of intel12 generation core CPU [small core full, large core onlookers] (win11)
Cmake Express
Codeforces Round #801 (Div. 2)A~C
Discussion on QWidget code setting style sheet
Solve the problem that intel12 generation core CPU single thread only runs on small cores
Story of [Kun Jintong]: talk about Chinese character coding and common character sets
本地可视化工具连接阿里云centOS服务器的redis
视频压缩编码和音频压缩编码基本原理
Installation and use of VMware Tools and open VM tools: solve the problems of incomplete screen and unable to transfer files of virtual machines
随机推荐
第5章 消费者组详解
【锟斤拷】的故事:谈谈汉字编码和常用字符集
ByteDance new programmer's growth secret: those glittering treasures mentors
FLV格式详解
Li Kou: the 81st biweekly match
原生js实现全选和反选的功能 --冯浩的博客
LeetCode 1636. Sort the array in ascending order by frequency
Research Report on market supply and demand and strategy of double drum magnetic separator industry in China
300th weekly match - leetcode
Codeforces - 1526C1&&C2 - Potions
Hbuilder X格式化快捷键设置
Educational Codeforces Round 130 (Rated for Div. 2)A~C
Raspberry pie 4b64 bit system installation miniconda (it took a few days to finally solve it)
Cmake Express
SQL快速入门
CMake Error: Could not create named generator Visual Studio 16 2019解决方法
字节跳动新程序员成长秘诀:那些闪闪发光的宝藏mentor们
Story of [Kun Jintong]: talk about Chinese character coding and common character sets
Install Jupiter notebook under Anaconda
力扣leetcode第 280 场周赛