当前位置:网站首页>String: LV1 eat hot pot
String: LV1 eat hot pot
2022-07-04 01:57:00 【HBUcs2020】
Compare with other questions , This question is quite simple , The code is as follows
#include<iostream>
using namespace std;
#include<string>
#include<cstring>
int main()
{
string s;
int num=0,flag=0;
int a[101]={0},num1=-1;
while(getline(cin,s)&&s!=".")
{
num++; // The first few sentences
if(s.find("chi1 huo3 guo1")!=-1)
{
flag=1;
a[++num1]=num;
}
}
cout<<num<<endl;
if(flag==0)
cout<<"-_-#"<<endl;
else
{
for(int i=0;i<=num1;i++)
{
// if(i==0)
// cout<<a[i];
// else
// {
// cout<<" "<<a[i]<<;
// }
cout<<a[0]<<" "<<num1+1;
break;
}
}
return 0;
}
subject :
The above picture comes from wechat circle of friends : It's basically useless for you to call me if you have something bad in this weather . But if you say “ Eat hot pot ”, That's great , Our story begins .
This problem requires you to implement a program , Automatically check if there is any in the message sent to you by your friend chi1 huo3 guo1.
Input format :
Each line of input gives a sentence that does not exceed 80 A character 、 Friend information ending with carriage return , The information is a non empty string , Just letters 、 Numbers 、 Space 、 Visible half angle punctuation . When you read a line with only one English period . when , End of input , This trip is not included in the friend information .
Output format :
First, output the total number of friend information in one line . Then to each line of information of friends , Check if it contains chi1 huo3 guo1, And count how many pieces of such powerful information . In the second line, first output the first occurrence chi1 huo3 guo1 What is your message ( from 1 Start counting ), Then output the total number of such information , Separated by a space . The title ensures that all numbers output do not exceed 100.
If a friend doesn't mention it from beginning to end chi1 huo3 guo1 Keyword , Then output an expression on the second line -_-#.
sample input 1:
Hello!
are you there?
wantta chi1 huo3 guo1?
that's so li hai le
our story begins from chi1 huo3 guo1 le
.
sample output 1:
5
3 2
sample input 2:
Hello!
are you there?
wantta qi huo3 guo1 chi1huo3guo1?
that's so li hai le
our story begins from ci1 huo4 guo2 le
.
sample output 2:
5
-_-#边栏推荐
- Example 072 calculation of salary it is known that the base salary of an employee of a company is 500 yuan. The amount of software sold by the employee and the Commission method are as follows: Sales
- 2022 new examination questions for safety management personnel of hazardous chemical business units and certificate examination for safety management personnel of hazardous chemical business units
- Feign implements dynamic URL
- Solution of cursor thickening
- The force deduction method summarizes the single elements in the 540 ordered array
- Luogu p1309 Swiss wheel
- Chapter 3.4: starrocks data import - Flink connector and CDC second level data synchronization
- G3 boiler water treatment registration examination and G3 boiler water treatment theory examination in 2022
- Install the pit that the electron has stepped on
- Is Shengang securities company as safe as other securities companies
猜你喜欢

MySQL deadly serial question 2 -- are you familiar with MySQL index?

Basic editing specifications and variables of shell script

Huawei BFD and NQA

Pytoch residual network RESNET

A fan summed up so many interview questions for you. There is always one you need!

Luogu p1309 Swiss wheel

Chapter 3.4: starrocks data import - Flink connector and CDC second level data synchronization

2020-12-02 SSM advanced integration Shang Silicon Valley

Conditional statements of shell programming
![Setting function of Jerry's watch management device [chapter]](/img/0b/8fab078e1046dbc22aa3327c49faa7.jpg)
Setting function of Jerry's watch management device [chapter]
随机推荐
Small program graduation project based on wechat video broadcast small program graduation project opening report function reference
Chain ide -- the infrastructure of the metauniverse
Mongodb learning notes: command line tools
ThinkPHP uses redis to update database tables
Rearrangement of tag number of cadence OrCAD components and sequence number of schematic page
JVM performance tuning and practical basic theory - medium
Magical usage of edge browser (highly recommended by program ape and student party)
Infiltration learning diary day19
Some other configurations on Huawei's spanning tree
The latest analysis of hoisting machinery command in 2022 and free examination questions of hoisting machinery command
Human resource management online assignment
Why is the operation unsuccessful (unresolved) uncaught syntaxerror: invalid or unexpected token (resolved)
Stringutils and collectionutils
Jerry's watch information type table [chapter]
PMP daily three questions (February 14, 2022)
When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview
Small program graduation project based on wechat reservation small program graduation project opening report reference
Write the first CUDA program
C import Xls data method summary V (complete code)
Example 073 square sum value judgment programming requires the input of a and B, if a ²+ b ² If the result of is greater than 100, a is output ²+ b ² Value, otherwise output the result of a + B.