Article Directory
Topic restatement
7-5 Valentine's Day (15 points)
The above is a wonderful post in the circle of friends: "It's Valentine's Day on February 14th, and I decided to benefit everyone. For the 2nd and 14th likes, I will introduce you to know... Let's eat three... You two please... ". Here is a list of friends who liked this post. Please find out the two hapless guests who want to treat.
Input format:
Enter the names of people who do not know how many likes are given in the order of the likes. Each person's name occupies a line and is a non-empty word with no more than 10 English letters, and ends with a carriage return. An English period. Marks the end of input. This symbol is not included in the like list.
Output format:
Output the conclusion in one line according to the likes: If there is a second person A and a 14th person B, then output "A and B are inviting you to dinner..."; if there is only A and no B, output "A is the only one" for you..."; if there is no A, output "Momo... No one is for you...".
Input example 1:
GaoXZh
Magi
Einst
Quark
LaoLao
FatMouse
ZhaShen
fantacy
latesum
SenSen
QuanQuan
whatever
whenever
Potaty
hahaha
.
Output sample 1:
Magi and Potaty are inviting you to dinner…
Input example 2:
LaoLao
FatMouse
whoever
.
Output sample 2:
FatMouse is the only one for you…
Input sample 3:
LaoLao
.
Output sample 3:
Momo… No one is for you …
code
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
int n=0;
string s1,s2,s;
for(1;s!=".";)
{
cin>>s;
n++;
if(n==2) s1=s;
if(n==14) s2=s;
}
if(n>=14)cout<<s1<<" and "<<s2<<" are inviting you to dinner..."<<endl;
else if(n>2)cout<<s1<<" is the only one for you..."<<endl;
else cout<<"Momo... No one is for you ..."<<endl;
}