当前位置:网站首页>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
-_-#
边栏推荐
- C import Xls data method summary V (complete code)
- Basic editing specifications and variables of shell script
- Pyinstaller packaging py script warning:lib not found and other related issues
- C import Xls data method summary II (save the uploaded file to the DataTable instance object)
- Development of user-defined navigation bar in uniapp
- The reasons why QT fails to connect to the database and common solutions
- LeetCode 168. Detailed explanation of Excel list name
- MPLS③
- The boss said: whoever wants to use double to define the amount of goods, just pack up and go
- Servlet simple verification code generation
猜你喜欢
MySQL introduction - functions (various function statistics, exercises, details, tables)
IPv6 experiment
Huawei cloud micro certification Huawei cloud computing service practice has been stable
How programmers find girlfriends through blind dates
Remember a lazy query error
Feign implements dynamic URL
Applet graduation project based on wechat selection voting applet graduation project opening report function reference
Applet graduation project is based on wechat classroom laboratory reservation applet graduation project opening report function reference
Three layer switching ①
Pyinstaller packaging py script warning:lib not found and other related issues
随机推荐
Remember a lazy query error
MySQL statement learning record
PMP daily three questions (February 14, 2022)
Sequence sorting of basic exercises of test questions
MySQL introduction - functions (various function statistics, exercises, details, tables)
Three layer switching ①
Pesticide synergist - current market situation and future development trend
Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!
MPLS③
How programmers find girlfriends through blind dates
Openbionics robot project introduction | bciduino community finishing
Portapack application development tutorial (XVII) nRF24L01 launch C
Human resource management online assignment
Functions and arrays of shell scripts
C import Xls data method summary III (processing data in datatable)
What is the intelligent monitoring system of sewage lifting pump station and does it play a big role
Audio resource settings for U3D resource management
Description of setting items of Jerry [chapter]
Pyrethroid pesticide intermediates - market status and future development trend
Should enterprises start building progressive web applications?