Giter Site home page Giter Site logo

fav-game's Introduction

fav-game

Favorite Game

Max likes football very much. In order to check the popularity of the game, he decided to talk to random people and ask them about their favorite game and note it down in a list. Given a list of name of people and their favorite sport, help Max in finding the sport liked by most of the people, and also how many people like football. He could have met same people more than once, he will only count response of his first meet with any person.

Note: The name of person as well as sport is a single string in uppercase. The length of the name of people as well as sport is less than 12.

Input:  First line will contain number of entries in the list. (i.e. N)  Next N lines will contain two strings, person’s name and sports he/she likes.

Output:  In first line, name of sport liked by most number of people (in case of more than one game is liked by highest number of people, output the first one in lexicographical order).  In second line, number of people having football as their favorite game.

Constraints:  1 ≤ N ≤ 100000  1 ≤ length (person name), length (sport name) ≤ 12  You can use in-build Java classes for key-value mapping.

Sample Input: 7 A cricket B football C cricket D cricket E chess F chess G chess

Sample output: Chess Football 1

fav-game's People

Contributors

lakinduoshadha avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.