Git Product home page Git Product logo

twitter-hash-tag's Introduction

Twitter Trending HashTags

Problem Description

Twitter shows trends in order to make its users aware of the trending news. These trends are nothing but trending hashtags that the users are tweeting about. For example: If thousands of users are talking about United States by adding a hashtag #US in their tweet, then US will be a trending hashtag. Couple of example tweets with hashtag #US could be:

Donald Trump becomes the 45th #US President Roger Federer wins #US Open for 5th time Given a list of N tweets, your task is to find top the five trending hashtags. Each tweet, let's call it S, will contain at least one one word with hashtag. There will be maximum of three hashtags in any tweet. All hashtags in a single tweet will be unique.

Input

First line of the input will contain N denoting the number of tweets. Next N lines, each will contain a string S.

Output

Print the top five trending hashtags. In case of tie between any two hashtags, print them in lexicographical order in a new line.

Constraints

10 ≤ N ≤ 10^3 1 ≤ | S | ≤ 140 where S denotes length of string S i.e. length of tweet. Any hashtag denoted by H 1 ≤ | H | ≤ 20 where H denotes length of any hashtag H.

Note

Any tweet is composed of lowercase and uppercase English letters, digits and spaces. Any hashtag begins with # and the subsequent characters will only contain lowercase and uppercase English letters and digits.

Sample Input

10
Donald Trump becomes the 45th #US President
Potentially habitable exoplanet #ProximaB discovered
#RogerFederer wins #US Open for 5th time
#GravitationalWaves detection successful
Traces of liquid water discovered on #Mars
Life Could Survive on Exoplanet #ProximaB
Go go #RogerFederer
Ten ways #ProximaB is different from Earth
ISRO becomes 4th space agency to reach #Mars
#RogerFederer beats #Nadal

Sample Output

#ProximaB
#RogerFederer
#Mars
#US
#GravitationalWaves

Usage

  1. Clone project repo: ssh/https url
  2. Run python trendBrain.py
  3. Give the same tweet as input
  4. Now you can see the Top Five trending Tweets

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.