当前位置:网站首页>String problem summary
String problem summary
2022-06-10 07:29:00 【Mulinyou】
1. Eating hot pot
This question asks you to check whether there is... In your friend's information “chi1 huo3 guo1”, Count the total number of such information , And record the first occurrence “chi1 huo3 guo1” What is your message .
ordinary find Just go , If there is a subscript that returns the found , If there is no return -1
This question does not make statistics “chi1 huo3 guo1” The total number of times , Just count the total number of messages that appear , It's better to solve this problem .
#include<iostream>
using namespace std;
#include<string>
int main()
{
string a;
getline(cin, a);
int count = 0;
int temp = -1;
string b = "chi1 huo3 guo1";
int num = 1;
while (a != ".")
{
int x=a.find(b);
if (x != -1)
{
count++;
if (count == 1)
temp = num;
}
getline(cin, a);
num++;
}
if (count == 0)
cout << "-_-#";
else
cout << temp<<" "<<count;
}边栏推荐
- 3 ZK's election mechanism
- 618大促火熱進行中,雲計算力挺電商直播
- Custom annotations support spiel expressions (dynamic parameters)
- 618 l'informatique en nuage stimule la diffusion en direct du commerce électronique
- Applet: scroll to the top of the page or an element position
- JS method to verify whether the content of the input box is empty
- markdown md 文件编辑器测试使用说明
- What if online gambling can't be withdrawn?
- 618 大促来袭,浅谈如何做好大促备战
- 一举刷新 54 个中文 NLP 任务基准,ERNIE3.0加持下的EasyDL可能是市面上最好用的NLP开发平台...
猜你喜欢

Analysis: stable currency is not "stable currency", but a product in essence

Capacitive isolation principle

8-1不安全的文件下载原理和案例演示

PyQt5基础学习

使用pyQt5 + agora + leanCloud实现基于学生疲劳检测的在线课堂

解决:vscode中go语言项目不能自动导包问题

What should I do if I fail to withdraw cash from online gambling?

Applet: get the current page routing information through getcurrentpages

PS 2022 installation failure error code 182 solution

Open source polardb's overall structure design and enterprise level features for the first time
随机推荐
Refresh 54 Chinese NLP task benchmarks at one stroke. Easydl under ernie3.0 may be the best NLP development platform on the market
Implicit type conversion (integer promoted part)
Matlab: polynomial representation and its basic operations
WPF data binding (III)
网上开户是安全的吗?
【动态规划】博弈论:取石子游戏合集
3 ZK's election mechanism
Next generation enterprise IT architecture: cloud native architecture
In the post epidemic era, how can the medical industry do a good job in digital transformation?
Fastjson using notes
Summary of technical scheme for automatic wool picking
2. zk的工作机制
【C语言】C语言程序设计:动态通讯录
Cython的使用
Nationwide provincial and municipal linkage JSON data
How to use Navicat to create an associated primary foreign key for two tables
New Phytologist: Wang Jianjun, et al. Reviewed the mountain microbiome and ecosystem functions under global change
30. localstorage and sessionstorage are unknown
mongo,mongodb优化思路
PyQt5基础学习