A. Neverending competitions
time limit per test

2 seconds

memory limit per test

512 megabytes

input

standard input

output

standard output

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.

 #include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int main()
{
int n, cnt1, cnt2;
string src, line;
while(cin>>n)
{
cnt1 = ;
cnt2 = ;
cin >> src;
for(int i = ; i < n; i++)
{
cin>>line;
if(src[] == line[] && src[] == line[] && src[] == line[]) cnt1++;
if(src[] == line[] && src[] == line[] && src[] == line[]) cnt2++;
}
if(cnt1==cnt2) cout<<"home"<<endl;
else cout<<"contest"<<endl;
}
return ;
}

765A Neverending competitions的更多相关文章

  1. 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 ...

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

    地址:http://codeforces.com/contest/765/problem/A 题目: A. Neverending competitions time limit per test 2 ...

  3. 【codeforces 765A】Neverending competitions

    [题目链接]:http://codeforces.com/contest/765/problem/A [题意] 给你一个人的n个行程 行程都是从家到某个地方或从某个地方到家; 且是无序的,且如果到了非 ...

  4. Codeforces Round #397 by Kaspersky Lab and Barcelona Bootcamp (Div. 1 + Div. 2 combined)

    运气好,分到的房里我最先开始Hack C题,Hack了12个,听说F题沙雕莫队但我不会,最后剩不到15分钟想出E题做法打了一波结果挂了,最后虽然上分了但总有点不甘心. 最后A掉ABCD Hack+12 ...

  5. CodeForces765A

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

  6. 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 ...

  7. Codeforces Round #397 题解

    Problem A. Neverending competitions 题目大意 一个团队有多个比赛,每次去比赛都会先订机票去比赛地点,然后再订机票返回.给出\(n\)个含有起止地点的购票记录(不按时 ...

  8. Improving your submission -- Kaggle Competitions

    1: Improving Our Features In the last mission, we made our first submission to Titanic: Machine Lear ...

  9. Getting started with Kaggle -- Kaggle Competitions

    1: The Competition We'll be learning how to generate a submission for a Kaggle competition. Kaggle i ...

随机推荐

  1. android studio 简介 (上)

    自从android官方宣布不再提供eclipse adt的更新之后,android studio的推进速度超乎想象得快,不管是github上的源码分享,还是stackoverflow上的问题提问,几乎 ...

  2. mybatis Dynamic SQL动态 SQL

    动态 SQL MyBatis 的强大特性之一便是它的动态 SQL.如果你有使用 JDBC 或其它类似框架的经验,你就能体会到根据不同条件拼接 SQL 语句的痛苦.例如拼接时要确保不能忘记添加必要的空格 ...

  3. Python之部分基础知识点汇总

    1.三元运算(又称三目运算) 三元运算(又称三目运算),简单条件语句的简写    if a<b: A    else: B等价于:A if a<b else B 2.

  4. Tornado之链接数据库

    5 数据库 知识点 torndb安装 连接初始化 执行语句 execute execute_rowcount 查询语句 get query 5.1 数据库 与Django框架相比,Tornado没有自 ...

  5. [Flutter] 支持描边效果的Text

    新版的flutter已经自带这个功能了.TextSyle 中一个shadow . 目前flutter中没找到很好的办法给Text增加描边.自己扩展了一个TextEx,可以实现简单的描边效果,能满足大部 ...

  6. idea 安装 破解方法

    参考:https://blog.csdn.net/qq_27686779/article/details/78870816 (1)下载破解补丁 把下载的破解补丁放在你的idea的安装目录下的bin的目 ...

  7. S+ hidden tray with window start

    官方论坛上有个帖子给出了答案: I forgot that this is supported in the code, but it requires a little editing of the ...

  8. JAVA WEB开发中的资源国际化

    为什么要国际化? 不同国家与地区语言,文化,生活习惯等差异.在数字,时间,语言,货币,日期,百分数等的不同. 两个名词: I18N:即资源国际化,全称为Internationalization,因为首 ...

  9. 数据恢复软件extundelete介绍

    linux下文件系统一般由文件名.Inode.Block三部分组成.当一个用户在Linux系统中试图访问一个文件时,系统会先根据文件名去查找它的inode,看该用户是否具有访问这个文件的权限.如果有, ...

  10. SQL事务日志备份时的问题

    1.在进行事务日志备份的时候,如下图: 3041 消息的疑难解答时的考虑事项:不会只是一个数据库或所有数据库出现问题吗?是备份到本地存储区或远程存储吗?哪种类型的备份 (数据库备份. 日志备份和差异备 ...