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
  1. 4
    SVO
    SVO->CDG
    LHR->SVO
    SVO->LHR
    CDG->SVO
Output
  1. home
Input
  1. 3
    SVO
    SVO->HKT
    HKT->SVO
    SVO->RAP
Output
  1. 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.

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int n, cnt1, cnt2;
  10. string src, line;
  11. while(cin>>n)
  12. {
  13. cnt1 = ;
  14. cnt2 = ;
  15. cin >> src;
  16. for(int i = ; i < n; i++)
  17. {
  18. cin>>line;
  19. if(src[] == line[] && src[] == line[] && src[] == line[]) cnt1++;
  20. if(src[] == line[] && src[] == line[] && src[] == line[]) cnt2++;
  21. }
  22. if(cnt1==cnt2) cout<<"home"<<endl;
  23. else cout<<"contest"<<endl;
  24. }
  25. return ;
  26. }

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. storm的流分组

    用的是ShuffleGrouping分组方式,并行度设置为3 这是跑下来的结果 参考代码StormTopologyShufferGrouping.java package yehua.storm; i ...

  2. tornado-模板,转义,上传静态文件

    class MainHandler(tornado.web.RequestHandler): def get(self): self.render("ces.html") def ...

  3. 安全svn快速安装

    按照如下步骤快速搭建centos6下的svn系统并支持https协议checkout和import代码,亲测成功! 1.[基本包yum安装] yum httpd subversion mod_dav_ ...

  4. [Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using pas sword: NO) (SQL: select * from information_schema.tables where table_schema = la

    [Illuminate\Database\QueryException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost ...

  5. DevExpress GridView 显示行号

    Private Sub GridView1_CustomDrawRowIndicator(sender As Object, e As RowIndicatorCustomDrawEventArgs) ...

  6. 微信公众号自动回复 node

    纯属分享记录: app.js var bodyParser = require('body-parser'); require('body-parser-xml')(bodyParser); var ...

  7. Vue2.0中v-for迭代语法变化(key、index)

    语法发生了变化:http://blog.csdn.net/sinat_35512245/article/details/53966788 新数组语法 value in arr (value, inde ...

  8. 免费json API

    免费json API http://www.bejson.com/knownjson/webInterface/

  9. UI5-文档-4.30-Debugging Tools

    虽然我们在前面的步骤中添加了一个基本的测试覆盖率,但是我们似乎不小心破坏了我们的应用程序,因为它不再显示价格到我们的发票上.我们需要调试这个问题,并在有人发现之前修复它. 幸运的是,SAPUI5提供了 ...

  10. UI5-文档-4.12-Shell Control as Container

    现在我们使用shell控件作为应用程序的容器,并使用它作为新的根元素.shell通过在桌面屏幕上引入一个所谓的信箱,来负责应用程序对设备屏幕大小的视觉调整. Preview The app is no ...