Codeforces Round #397 by Kaspersky Lab and Barcelona bootcamp (div. 1 + div. 2 combined) A

Source: Internet
Author: User

Description

There is literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some re Ason They prefer name "Snookah")! When a competition takes place somewhere far from their hometown, Ivan, Artsem and Konstantin take a flight to the contest and back.

Jinotega ' s best friends, team Base has found a list of their itinerary receipts with information about departure and Arri Val Airports. Now they wonder, where are Jinotega now:at home or at some competition far away? They know that:

    • This list contains all Jinotega ' s flights in the this year (in arbitrary order),
    • Jinotega have only flown from he hometown to a snooker contest and back,
    • After all competition Jinotega flies back home (though they could attend a competition in one place several times),
    • And finally, at the beginning of the year Jinotega is at home.

them to determine Jinotega ' s location!

Input

The first line of input there are a single integer n: The number of Jinotega ' s flights (1?≤? n? ≤?100). The second line there are a string of 3 capital Latin letters:the name of Jinotega ' s home airport. In the next n Lines There are flight information, one flight per line, in form "xxx->yyy", where "X XX "is the name of departure airport"YYY "is the name of the arrival airport. Exactly one of these airports is Jinotega ' s home airport.

It is guaranteed that flights information are consistent with the knowledge of Jinotega ' s friends, which are described in th E main part of the statement.

Output

If Jinotega is now at home, print "home" (without quotes), otherwise print "contest".

Examples input
4
SVO
Svo->cdg
Lhr->svo
Svo->lhr
Cdg->svo
Output
Home
input
3
SVO
Svo->hkt
Hkt->svo
Svo->rap
Output
Contest
Note

In the first sample Jinotega might first fly from SVO to CDG and back, and then from SVO to LHR and back, so now they shou LD is at home. In the second sample Jinotega must now being at raps because a flight from rap back to SVO are not on the list.

Test instructions: Tell us the flight process of the plane, at the beginning of the year at home, (notice the topic said from home will come back) finally asked us, he is at home or contest

Solution: Since the departure from home will return, then we just have to compare the number of times the odd-and-even sex is on the line, the numbers are at home, odd is not back

1#include <bits/stdc++.h>2 using namespacestd;3 intN;4 Chars1[ $],s2[ $];5 intMain ()6 {7     intans=0;8Cin>>N;9scanf"%s", S1);Ten      for(intI=0; i<n;i++) One     { Ascanf"%s", S2); -         if(STRSTR (S2,S1)! =NULL) -         { theans++; -         } -     } -     if(ans%2) +     { -cout<<"Contest"; +     } A     Else at     { -cout<<"Home"; -     } -     return 0; -}

Codeforces Round #397 by Kaspersky Lab and Barcelona bootcamp (div. 1 + div. 2 combined) A

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.