Skip to content

JoelPintoMata/Most_Popular_Destination_RegEx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Find the Most Popular Destination:

Your task is to find the most popular holiday destination from a list of destinations searched for by users. You are given as standard input the integer size of the list, followed by the names of the destinations themselves. The input has the following format:

on the first line, the count of items in the list on the subsequent lines, the name of each destination searched for, one per line (each destination is a single word with no spaces, destinations can be searched for and appear more than once) The input is correct. There is at least one destination in the input. Write a program that reads the input from stdin and then outputs out the name of the most searched for destination i.e. the destination that appears most in the list. One destination is guaranteed to be the outright winner in the input. Examples:

Input: 6 Barcelona Edinburgh Barcelona Miami Miami Barcelona Output: Barcelona Input: 5 Singapore Bangkok Singapore Bangkok Singapore Output: Singapore

Available imports: import java.util.LinkedList; import java.util.List; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern;

About

Find the most popular destination using regular expressions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages