Description

There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason 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 have found a list of their itinerary receipts with information about departure and arrival airports. Now they wonder, where is Jinotega now: at home or at some competition far away? They know that:

  • this list contains all Jinotega's flights in this year (in arbitrary order),
  • Jinotega has only flown from his hometown to a snooker contest and back,
  • after each competition Jinotega flies back home (though they may attend a competition in one place several times),
  • and finally, at the beginning of the year Jinotega was at home.

Please help them to determine Jinotega's location!

Input

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

It is guaranteed that flights information is consistent with the knowledge of Jinotega's friends, which is described in the 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 should be at home. In the second sample Jinotega must now be at RAP because a flight from RAP back to SVO is not on the list.

题意:告诉我们飞机的航班流程,年初在家,(注意题目说从家里出发是会回来的)最后问我们,他是在home还是contest

解法:既然从家里出发会返回,那么我们只要比较出现家的次数奇偶性就行,偶数就是在家,奇数就是还没有回来

 #include<bits/stdc++.h>
using namespace std;
int n;
char s1[],s2[];
int main()
{
int ans=;
cin>>n;
scanf("%s",s1);
for(int i=;i<n;i++)
{
scanf("%s",s2);
if(strstr(s2,s1)!=NULL)
{
ans++;
}
}
if(ans%)
{
cout<<"contest";
}
else
{
cout<<"home";
}
return ;
}

Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A的更多相关文章

  1. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) F. Souvenirs 线段树套set

    F. Souvenirs 题目连接: http://codeforces.com/contest/765/problem/F Description Artsem is on vacation and ...

  2. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) E. Tree Folding 拓扑排序

    E. Tree Folding 题目连接: http://codeforces.com/contest/765/problem/E Description Vanya wants to minimiz ...

  3. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) D. Artsem and Saunders 数学 构造

    D. Artsem and Saunders 题目连接: http://codeforces.com/contest/765/problem/D Description Artsem has a fr ...

  4. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) C. Table Tennis Game 2 水题

    C. Table Tennis Game 2 题目连接: http://codeforces.com/contest/765/problem/C Description Misha and Vanya ...

  5. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) B. Code obfuscation 水题

    B. Code obfuscation 题目连接: http://codeforces.com/contest/765/problem/B Description Kostya likes Codef ...

  6. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A. Neverending competitions 水题

    A. Neverending competitions 题目连接: http://codeforces.com/contest/765/problem/A Description There are ...

  7. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) A B C D 水 模拟 构造

    A. Neverending competitions time limit per test 2 seconds memory limit per test 512 megabytes input ...

  8. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) E. Tree Folding

    地址:http://codeforces.com/contest/765/problem/E 题目: E. Tree Folding time limit per test 2 seconds mem ...

  9. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) D. Artsem and Saunders

    地址:http://codeforces.com/contest/765/problem/D 题目: D. Artsem and Saunders time limit per test 2 seco ...

  10. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined) C - Table Tennis Game 2

    地址:http://codeforces.com/contest/765/problem/C 题目: C. Table Tennis Game 2 time limit per test 2 seco ...

随机推荐

  1. async函数学习笔记

    含义 async函数是什么?一句话,它就是Generator函数的语法糖. const fs = require('fs') const readFile = function(fileName){ ...

  2. [RK3288][Android6.0] 调试笔记 --- 软硬键盘同时使用【转】

    本文转载自:http://blog.csdn.net/kris_fei/article/details/78748313 Platform: RK3288 OS: Android 6.0 Kernel ...

  3. platform_set_drvdata()/platform_get_drvdata()/container_of()【转】

    本文转载自:http://blog.csdn.net/angle_birds/article/details/8443695 platform_set_drvdata(struct platform_ ...

  4. 自动化测试框架PatatiumWebUi

    PatatiumWebUi 官网:https://git.oschina.net/zhengshuheng/PatatiumWebUi 这是Java编写的框架,基于Selenium.TestNG等技术 ...

  5. COGS【345】共荣圈 && 【426】血帆海盗

    题面 UPD:COGS 貌似进不去了,链接失效就删掉了. 如果你不小心看到了题目评论区,那你就会知道这是一道双倍经验题,另一题的链接见题目评论区…… 网络流+tarjan好题,但如果你真的的理解了网络 ...

  6. web.xml 有什么用?

    1.每个javaEE工程中都有web.xml文件,那么它的作用是什么呢?它是每个web.xml工程都必须的吗? 一个web中可以没有web.xml文件,也就是说,web.xml文件并不是web工程必须 ...

  7. 搜索算法 pots

    题目链接  点击打开链接 Pots Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Su ...

  8. javascript之闭包,递归,深拷贝

    闭包 理解:a函数执行后return出b函数且b函数可以访问a函数的数据 好处:子函数存储在复函数内部,子函数执行完不会被自动销毁 坏处:占用内存比较大 ex: function bibao(){ v ...

  9. windows安装PHP5.4+Apache2.4+Mysql5.5

    windows安装PHP5.4+Apache2.4+Mysql5.5 作者:星之宇 ┊ 时间:2012-10-18 14:27 ┊ 分类: 网站技术 ┊ 阅读:1232 ┊ 评论:16 最近听说PHP ...

  10. 性能测试之Jmeter学习(一)

    一.Jmeter的安装: 1.安装配置要求: Java版本: Jmeter要求完全兼容的Java6或更高版本(建议安装java 8或以上版本): 操作系统:是一个100%的Java程序,它在任何支持完 ...