当前位置:网站首页>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
-_-#
边栏推荐
- Functions and arrays of shell scripts
- Remember a lazy query error
- Day05 branch and loop (II)
- 2020-12-02 SSM advanced integration Shang Silicon Valley
- How can enterprises optimize the best cost of cloud computing?
- QML add gradient animation during state transition
- Maximum likelihood method, likelihood function and log likelihood function
- Huawei rip and BFD linkage
- Pesticide synergist - current market situation and future development trend
- Mobile phone battery - current market situation and future development trend
猜你喜欢
Should enterprises start building progressive web applications?
String hash, find the string hash value after deleting any character, double hash
Jerry's synchronous weather information to equipment [chapter]
What is the intelligent monitoring system of sewage lifting pump station and does it play a big role
Maximum likelihood method, likelihood function and log likelihood function
Chain ide -- the infrastructure of the metauniverse
Some other configurations on Huawei's spanning tree
Write the first CUDA program
Feign implements dynamic URL
Magical usage of edge browser (highly recommended by program ape and student party)
随机推荐
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
Software product download collection
Make drop-down menu
51 single chip microcomputer timer 2 is used as serial port
Writeup (real questions and analysis of ciscn over the years) of the preliminary competition of national college students' information security competition
Feign implements dynamic URL
A. Div. 7
[turn] solve the problem of "RSA public key not find" appearing in Navicat premium 15 registration
Flex flexible layout, box in the middle of the page
Magical usage of edge browser (highly recommended by program ape and student party)
Small program graduation project based on wechat video broadcast small program graduation project opening report function reference
Jerry's watch information type table [chapter]
Day05 branch and loop (II)
Should enterprises start building progressive web applications?
TP5 automatic registration hook mechanism hook extension, with a complete case
Idea if a class cannot be found, it will be red
Skku| autonomous handover decision of UAV Based on deep reinforcement learning
MySQL introduction - functions (various function statistics, exercises, details, tables)
Applet graduation design is based on wechat course appointment registration. Applet graduation design opening report function reference
C import Xls data method summary I (upload files and create Workbooks)